Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Script to give a result then assign a variable to each with user intput

$
0
0

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.

  1. 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:
  2.                  Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase 'ou=Clients,DC=domain,DC=local' -SearchScope                  OneLevel | FT Name
  3. results options:
  4.           OU1, OU2, OU3
  5. I would like there to be variables assigned to each of these (I think) $OU1, $OU2, $OU3 to get my final results
  6. 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.
  7.                 Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase '$OU=$OU1,ou=Clients,DC=SSBCUSA,DC=local'                  -SearchScope OneLevel | FT Name 
  8. Result Options:
  9. Sub1, Sub2, Sub3
  10.        In other words I need the new box to show the results of the sub OU's within the answer they selected.
  11. 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


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>