I am looking to have a script that will do a few things.
My goal is to have the ability to look at Active Directory within a certain OU parent, allow the user to select one of the sub OU's, then yet another Sub OU to add an OU for their own site.
I simply need my script to run the DSAdd to create an OU in the appropriate spot.
Here is my thought process.
- when the script runs, it will show the results in a window (Box) that a user can choose from of a search in active directory ie:
- Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase 'ou=Clients,DC=domain,DC=local' -SearchScope OneLevel | FT Name
- results options:
- OU1, OU2, OU3
- I would like there to be variables assigned to each of these (I think) $OU1, $OU2, $OU3 to get my final results
- Then when they choose one of the 3 I would like the next windows (box) to show the results of the one they choose ie.
- Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase '$OU=$OU1,ou=Clients,DC=SSBCUSA,DC=local' -SearchScope OneLevel | FT Name
- Result Options:
- Sub1, Sub2, Sub3
- In other words I need the new box to show the results of the sub OU's within the answer they selected.
- Then finally a box that will allow them to enter the name of the new OU within the OU from the 2nd answer.
Maybe it would be best to set variables to all the parent OU's and then allow the option to select which one.
I would need a script that says. If the "option 1" (which would be equal to the actual LDAP path( then assign this $variable, then if option 2, assign this $variable, Enter your site name here, then the script would automatically add, then create
a variable to the new OU $path, so that I could use the variable to run the rest of my script.
I know this is a lot, however, if we have a master that would nail this down, that would be great.
Thank you!
Paul
Duramaxster