I have this search:
Get-ADUser -filter {enabled -eq $true -and pwdLastSet -eq 0} -Properties mail |
where {$.mail -ne $null -and $.DistinguishedName -ne “OU=DisabledUsers,DC=mycorp,DC=com”} | Measure-Object
…but it’s still including accounts in the DisabledUsers OU.
is my Operator incorrect or my Where-Object logic?
Thank you