I work very little with Exchange so I apologize if I seem clueless. What I'm trying to do is query the size of all mailboxes and e-mail that information to myself once a week. Currently I log into our exchange server and run a shell command to output this information to a text file. That command is:
Get-MailboxStatistics |where {$_.TotalItemSize -gt 1MB} | sort $_.TotalItemSize |FT DisplayName,ItemCount,TotalItemSize >c:\size.txt
I would really like to have this automated and e-mailed to myself once a week. How would I go about setting this up?
You can put the following in a script file and schedule it to run once a week:
Get-MailboxStatistics | `
Where-Object {$_.TotalItemSize -gt 1MB} | `
Sort-Object TotalItemSize | `
Format-Table DisplayName,ItemCount,TotalItemSize |`
Out-File c:\size.txt
Send-MailMessage -From you@domain.com -To you@domain.com -SmtpServer smtp1 -Subject 'Weekly Mailbox Statistics Report' -Attachments c:\size.txt