Hi, I’m trying to get the following to work using text from a textbox and It’s not liking the variable I’m using.
$1 = $textbox4.text
get-adgroup -Filter {name -like "*$1*"} -Properties * -SearchBase "ou=esd,dc=dom2,dc=sch,dc=com" | select name
Any ideas. Thanks for any help in advance.
Olaf
2
What’s wrong with it? Do you get errors? If yes - it would have been pretty helpful to post these errors as well.
Tony Rodal,
I’ve just faced a similar problem.
Try this:
$1 = $textbox4.text
get-adgroup -Filter "name -like '*$1*'" -Properties * -SearchBase "ou=esd,dc=dom2,dc=sch,dc=com" | select name
Found the answer on the last post of this topic on Technet:
https://social.technet.microsoft.com/Forums/exchange/en-US/8998f61e-6954-4b47-84e7-94413e361666/powershell-and-getmailbox-filter?forum=exchangesvradminlegacy
All credits go to TenOf11 (TenOf11's Profile)
That worked great. Thanks for the help!! 