Im trying to write a script that takes the name of a divison we have and outputs the user. For starts i have a script that will filter based on AD Description, and will spit out the desired users in said division. However these are div codes and not all users know the codes. I'd like them to be able to enter for example Head Office or Marketing, and have my scrip translate the name into a code. It's fine if the output still shows the ad descption though. So far i have it working like this
$Description = Read-Host "Enter department code EX ABC.00.A.90.AD"
Get-ADComputer -Filter "Description -like '*$Description*'" -properties description | Select Name, Description
I know i need to store the input from the user into a different variable, im just not sure how to go about doing that.
This spits out the desired output as is. But i'd like to make it a bit easier by just having them enter the name of the division. For example
Head office = ABC.00.A.90.AD Marketing planning = ABC.BC.0.90.AD
What i want is a list of divisions at the top that the script will check and still output the same result as the script above. Is that possible?
So the end result would like something like this?
$Description = Read-Host "Enter department Name EX Head Office:"
Get-ADComputer -Filter "Description -like '*$Description*'" -properties description | Select Name, Description