I want to know how many Users whose ending are two numbers there are where the Attribute "UserParameters" is null. This is my command so far:
$var1 = Get-ADUser -Filter {SamAccountName -like "*[0-9][0-9]"} -SearchBase "OU=xxxxxxxxxxxxxx,DC=xxxxxxx,DC=xx" | Where-Object {$_.UserParameters -eq $null}
If I type in $var1.count it just replies with 0. Why is that so? And yes there are users that end with two numbers. I think the -Filter is the Problem because if I just type -Filter * it works just fine.
Please help me!
The AD Filter provider has no clue what the wildcard
[0-9]means. You can construct an LDAP Filter yourself if needed which would essentianlly be an OR pattern|:For example: