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?
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.
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. [/quote]