Powershell experts critique this command please

Soldato
Joined
18 May 2010
Posts
12,847
Hi,

I'm not the best with PS and I've pieced this together by googling, I need to know I've done it right as the result is unexpected. If you ran this command what would you expect it to do please?

get-mailbox -resultsize unlimited | Search-Mailbox -SearchQuery "to:***@***.com AND from:***@***.com" -EstimateResultOnly | select displayname,resultitemscount | Export-Csv c:\scripts\Results.csv

Thanks
 
Hi,

I'm not the best with PS and I've pieced this together by googling, I need to know I've done it right as the result is unexpected. If you ran this command what would you expect it to do please?

get-mailbox -resultsize unlimited | Search-Mailbox -SearchQuery "to:***@***.com AND from:***@***.com" -EstimateResultOnly | select displayname,resultitemscount | Export-Csv c:\scripts\Results.csv

Thanks

Get All results from mail server that have emails to: [email protected] [email protected], showing the displayname & count them into into a CSV

So CSV would look like

Email Count
[email protected] 40
[email protected] 50
so on..
 
Get All results from mail server that have emails to: [email protected] [email protected], showing the displayname & count them into into a CSV

So CSV would look like

Email Count
[email protected] 40
[email protected] 50
so on..

Yes correct thanks for confirming, you missed that it should be To and From the mail address and I figured out why it wasn't working without throwing an error, it should be "Or" not "And" its working fine now and have the results I need

Cheers
 
Yes correct thanks for confirming, you missed that it should be To and From the mail address and I figured out why it wasn't working without throwing an error, it should be "Or" not "And" its working fine now and have the results I need

Cheers
no problem, PS can be fun & also horrid at the same time.
 
Back
Top Bottom