How can I search for user using quest cmdlets (Get-QADUser) for accounts containing an "_" (underscore) followed by any 3 characters for eg.
User01_ad1, User55_a2d, User116_arr, User9999_1ad
I tried following but it does seem to work:
Get-QADUser -LdapFilter '(samaccountname=*_???)'
does get-qaduser does not recognize "?" as wildcard?
Single character wildcard is not available (MSDN). You can get accounts with _
using Get-QADUser
and fine-tune the results with a -match
regex-pattern using Where-Object
.
Ex getting all accounts that end with underscore and three chars:
Get-QADUser -SamAccountName "*_*" | Where-Object { $_.SamAccountName -match '_\w{3}$' }