Powershell: Get-aduser filter with two conditions

 PowerShell to filter two conditions.


$list = get-aduser -filter {enabled -eq "true" -and passwordNeverExpires -eq "false" } -properties Name, PasswordNeverExpires 

#|  Select-Object DistinguishedName, Name, Enabled

$count = $list.Count

Comments

Popular posts from this blog

Troubleshooting Netlogon Error Codes

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

Troubleshooting AD Active Directory Replication Error 8456 or 8457: "The source | destination server is currently rejecting replication requests"