Run a script for user objects in a specific OU, but exclude a few OUs in that OU
While the script I have setup doesn't give me any errors, it's not filtering out the OUs I have named in them. I'm somehow missing something.
Powershell
get-aduser-SearchBase"OU=User Accounts,OU=Company Name,DC=company,DC=local"-Filter*-propertiespasswordlastset|?{$_.DistinguishedName-notlike"*OU=Cisco Phone System Accounts,OU=User Accounts,OU=Company Name,DC=company,DC=local*"-and$_DistinguishedName-notlike"*OU=Book,OU=User Accounts,OU=Company Name,DC=company,DC=local*"-and$_DistinguishedName-notlike"*OU=WebAccess,OU=User Accounts,OU=Company Name,DC=company,DC=local*"-and$_DistinguishedName-notlike"*OU=UtilityAccounts,OU=User Accounts,OU=Company Name,DC=company,DC=local*"-and$_DistinguishedName-notlike"*OU=VendorAccounts,OU=User...