Move newly created AD object to particular OU after accepting input

Welcome Forums General PowerShell Q&A Move newly created AD object to particular OU after accepting input

Viewing 2 reply threads
  • Author
    Posts
    • #238349
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      Hi I am new to powershell, trying to create a script to create new AD accounts and then immediately move the object to a particular OU based on user input.

      Below is the snipped of code, I am trying to call the firstname and lastname which the user has input previously, when finding that it moves the object to the specified OU, how can I do this?

      [/crayon]
      • This topic was modified 2 months, 3 weeks ago by verma210884.
      • This topic was modified 2 months, 3 weeks ago by verma210884.
      • This topic was modified 2 months, 3 weeks ago by verma210884.
    • #238358
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      Akshay, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      When you post code, error messages, sample data or console output format it as code, please.
      In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
      Thanks in advance.

      A much better option would be to create the AD object where you want it to be right away. Therefor you’d provide the path for the cmdlet New-ADUser. That would make the step of moving it obsolete. If you insist to do it this way you may save the newly created AD object in a variable. This you can easily move wherever you want. 😉

    • #238370
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      Akshay, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      When you post code, error messages, sample data or console output format it as code, please.

      In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.

      Thanks in advance.

      A much better option would be to create the AD object where you want it to be right away. Therefor you’d provide the path for the cmdlet New-ADUser. That would make the step of moving it obsolete. If you insist to do it this way you may save the newly created AD object in a variable. This you can easily move wherever you want. 😉

      Thanks so much, very helpful.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.