--勉励自己努力以钉子的“挤”劲和“钻”劲提升自己
 :: Blog List ::
钉子 发表于 2014-12-16 18:21:30


All what’s inside * * should be edited

If ((Get-PSSnapin | where {$_.Name -match “Exchange.Management”}) -eq $null)
 {
 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
 }
 $toArray=Get-Mailboxdatabase *databasename* | Get-Mailbox | foreach-object {$email = $_.primarysmtpaddress; $_ | Get-MailboxStatistics | Where {$_.TotalItemSize.Value.ToMB() -gt 512 } | select @{ expression={$email}}}
 $from= “*Administartor@domain.com*”
Foreach ($to in $toArray)
 {
 $s=[string]$to
 [int]$Start = $s.IndexOf(“=”)
 [int]$End = $s.IndexOf(“}”)
 [string]$ss=$s.Substring($Start+1,$End-$start-1)
 $Statistics = Get-MailboxStatistics $ss
 $name = Get-Mailbox $ss
 $messageParameters = @{
 smtpServer = “*ExchangeCASHUBserver*”
From = [string]$from
 To = $ss
 Subject = “Warning!”
Body = “Hi “+ $name + “.Your mailbox size is ” + $Statistics.TotalItemSize + ” Your mailbox size limit is 500 MB. Please delete unnecessary emails to reduce size of your mailbox ”
}
Send-MailMessage @messageParameters -BodyAsHtml
 }

参考:http://msexchangeguru.com/2012/08/21/quota-warning/

发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:
Best view with 1024 x 768 pixel & IE 6.0.
About Me
Archives Categories
Replies List
My FriendLinks
Blog Info

Powered by Oblog.