Powershell resultsize not working

By |2017-12-08T14:28:04+00:00June 19th, 2014|PowerShell|0 Comments

Here’s an interesting one I came across today, I wanted to do a get-mailbox with a result size specified and a where clause, something like this:

get-mailbox -resultsize 250 | where-object {$_.emailaddresses -like “*MBX:0*”} | Where-Object {$_.ExchangeUserAccountControl -ne “AccountDisabled”} | measure-object

However it failed with the following error:

WARNING: There are more results available than are currently displayed. To view them, increase the value for the ResultSize parameter.

But when running just the get-mailbox –resultsize 250 on its own it worked fine. To work around this I changed the resultsize to unlimited and told it to get the top 250 results:

get-mailbox -resultsize unlimed | where-object {$_.emailaddresses -like “*MBX:0*”} | Where-Object {$_.ExchangeUserAccountControl -ne “AccountDisabled”} | Select-Object –First 250 | measure-object

Worked like a charm! Hope it helps J

Leave A Comment

like what you see? 

Sign-up to our newsletter and never miss out on the latest blogs, events and tech news from the world of risual
SUBSCRIBE!
Give it a try, you can unsubscribe anytime.