Quantcast
Channel: Exchange Server 2010 forum
Viewing all articles
Browse latest Browse all 19214

Powershell -OR operator problems

$
0
0

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


Viewing all articles
Browse latest Browse all 19214

Trending Articles