Another Mailbox Size Mod
Per request, this one just prints the down and dirty, mailbox name and size. This works on Ex2003 only.
'**************************************************
On Error Resume Next
'Written to a file instead of Echoed on the screen
set objReadFSO = CreateObject ("Scripting.FileSystemObject")
set objOutputFile = objReadFSO.CreateTextFile("c:\Mailboxes.txt")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery _
("Select * from Exchange_Mailbox")
For Each objItem in colItems
objOutputFile.Writeline objItem.MailboxDisplayName & _
"," & objItem.Size
Next
objOutputFile.Close
set objReadFSO = Nothing
set objOutputFile = Nothing
Set objWMIService = Nothing
Set colItems = Nothing
Wscript.Echo "All Done"
'**************************************************
On Error Resume Next
'Written to a file instead of Echoed on the screen
set objReadFSO = CreateObject ("Scripting.FileSystemObject")
set objOutputFile = objReadFSO.CreateTextFile("c:\Mailboxes.txt")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery _
("Select * from Exchange_Mailbox")
For Each objItem in colItems
objOutputFile.Writeline objItem.MailboxDisplayName & _
"," & objItem.Size
Next
objOutputFile.Close
set objReadFSO = Nothing
set objOutputFile = Nothing
Set objWMIService = Nothing
Set colItems = Nothing
Wscript.Echo "All Done"
1 Comments:
Perfect little script.
Just what I needed. Nothing fancy, but very functional.
Thanks,
Dave
By Anonymous, at 4:08 PM
Post a Comment
<< Home