I am querying a user for an AD group name. I then want to confirm the group is in AD. However, the group name has spaces. I have tried many things to deal with this, none of which is successful. This is an excerpt of the script I am using:
$Trustee = ‘WinNT://’,"$env:userdomain",’/’,"$trustee" -join ‘’
$ADResolve = ([adsisearcher]"(samaccountname=$Trustee)").findone().properties[‘samaccountname’]
Can someone help me?