powershell: use variable with wildcard with get-aduser
- by user179037
powershell newbie here. I am building a simple bit of code to help me find user's by entering letters of user names. How do I get a wildcard to work w/ a variable?
this works:
$name=read-host -prompt "enter user's first or last initial"
$userInput=get-aduser -f {givenname -like 'A*' }
cmd /c echo "output: $userInput"
this does not:
$name=read-host -prompt "enter user's first or last initial"
$userInput=get-aduser -f {givenname -like '$name*' }
cmd /c echo "output: $userInput"
The first bit of code delivers a list of users with "A" in their name. Any suggestions woudl be appreciated. thanks