Listing only certain exchange mail servers powershell

techdrive used Ask the Experts™
I am looking for a way to only list a few of our servers rather than all the servers in our environment. I have tried the following . FYI: This is powershell exchange 2007

$serverlist=get-content c:\temp\serverlist.txt
foreach($servers in $serverlist) {
get-exchangeserver $server | get-mailbox | where {$_.prohitibSendQuota -eq [0-9]  } |

format-table -autosize Displayname, TotalItemSize,ItemCount

Two things are failing the first is it is erroring out and in addition I am trying to find a value with only a number

Second thing I have tried is this. With this command it is listing all the servers and skipping over what I have in the query. Please help.

get-mailbox -resultsize unlimited | where {$_.servername -eq "server1" -or $_.server -eq  "server2"} | select Alias, servername, ProhibitSendquota

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
PowerShell Developer
Top Expert 2010
I'd have thought...
Get-Content c:\temp\serverlist.txt | Get-MailboxServer | Get-Mailbox | Where-Object { $_.ProhibitSendQuota -ne "unlimited" }

Open in new window

Do you want those fields you selected? Or something more?


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial