I have been trying to get the following command right to show me all mailboxes where the last name does not begin with A, B or C.
Get-mailbox -database "DB A-C" | Where {$_.LastName -inotlike "A*" -OR $_.LastName -inotlike "B*" -OR $_.LastName -inotlike "C*"} | FL FirstName, LastName
This doesn't work and give me all mailboxes.
If i run
Get-mailbox -database "DB A-C" | Where {$_.LastName -notlike "a*"} | FL FirstName, LastName
I get all mailboxes other than the ones beginning with A, so i think my problem is with the -OR operator.
Any anyone correct this?
Thanks