切换到宽版
  • 4843阅读
  • 0回复

[求助]使用脚本列出邮箱超过邮箱限制的收件人 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2011-03-09
— 本帖被 YOYO 从 Exchange 脚本中心 移动到本区(2015-06-25) —
  • 脚本环境:Visual Basic
  • 适合版本:Exchange 2003
  • 适用平台:
  • 脚本作用:运行些脚本可以帮助你将超过限制的邮箱大小的收件人罗列出来。可以很明显的看出有哪些收件人超过了些限制。
strComputer = "."
intMailboxSize = 2048 'size in KB, all recipient who exceeds this amount will be displayed

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\ROOT\MicrosoftExchangeV2")

Set colItems = objWMIService.ExecQuery("Select * from Exchange_Mailbox where size > " & intMailboxSize)
if colItems.count = 0 then 'no recipients were found
    wscript.echo "No items were found"
    wscript.quit
end if

mbs_len = len("MAILBOX SIZE(KB)")
mbdn_len = len("MAILBOX DISPLAY NAME")
wscript.echo "MAILBOX DISPLAY NAME" & space(30 - mbdn_len) & "MAILBOX SIZE(KB)"

For Each objItem in colItems
    if     len(objItem.MailboxDisplayName) > 30 then
        padding = 0
        Wscript.stdOut.write left(objItem.MailboxDisplayName,27) & "..." & space(padding)
    else
        padding = 30 - len(objItem.MailboxDisplayName)
        Wscript.stdOut.write objItem.MailboxDisplayName & space(padding)
    end if
    Wscript.stdOut.write space(mbs_len - len(cstr(objItem.Size))) & objItem.Size
    wscript.echo
next
分享到
快速回复
限60 字节
 
上一个 下一个