Hey I've got this cmdlet here:
Get-ADUser -filter {(distinguishedName -notlike "Disabled Users") -and (enabled -eq $false)} -searchBase "ou=FirstOU,dc=domain,dc=com"
I've built it to find disabled users that are not in the "Disabled Users" OU. (an OU within an OU)
But for some reason it returns not only the disabled users that are not in "Disabled Users", but the disabled users that are in it as well.
Why doesn't (distinguishedName -notlike "Disabled Users")
work?
To make my structure clear:
Forest
FirstOU
users,groups,etc..
Disabled Users OU
.
.
.