I’m currently working on a script that would gather output generated from a command and use that dynamic output as a list of choices for the next prompt.
echo “List of New Hire OUs:”
Get-ADOrganizationalUnit -LDAPFilter ‘(name=*)’ -SearchBase ‘OU=New Hire Staging,OU=service accounts,dc=MyDomain,dc=net’ -SearchScope OneLevel | ft name
would return this output:
I would prefer the output to look like this:
and then the user could choose 1-3. The list is dynamic and could have any number of options. The associated value of the output (i.e. 3-30-2015, 4-6-2015) would be assgined to a variable called $startdate.
I’ve got the code all set to execute every other command if the actual full date is entered, but I’d rather give the user a list of choices and have them pick a single number from that.