This blog is by design...

Thursday, August 18, 2005

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"

Wednesday, August 17, 2005

List Exchange 2003 Mailbox Information

The following script is a small modification on the MS script posted here: List Exchange Mailbox Information
This simply causes the script to output the information to a text file rather than echoing it to the screen. If you need historical tracking, or mailbox growth tracking, I believe Glen Scales has an excellent script for such things on his Blog, but then again, all his scripts and programs are excellent IMHO.


'**************************************************
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 "Associated content count: " & _
objItem.AssocContentCount

objOutputFile.Writeline "Date discovered absent in DS: " & _
objItem.DateDiscoveredAbsentInDS

objOutputFile.Writeline "Delete messages size extended: " & _
objItem.DeletedMessageSizeExtended

objOutputFile.Writeline "Last logged-on user account: " & _
objItem.LastLoggedOnUserAccount

objOutputFile.Writeline "Last logoff time: " & _
objItem.LastLogoffTime

objOutputFile.Writeline "Last logon time: " & _
objItem.LastLogonTime

objOutputFile.Writeline "Legacy distinguished name: " & _
objItem.LegacyDN

objOutputFile.Writeline "Mailbox display name: " & _
objItem.MailboxDisplayName

objOutputFile.Writeline "Mailbox GUID: " & _
objItem.MailboxGUID

objOutputFile.Writeline "Server name: " & _
objItem.ServerName

objOutputFile.Writeline "Size: " & _
objItem.Size

objOutputFile.Writeline "Storage group name: " & _
objItem.StorageGroupName

objOutputFile.Writeline "Storage limit information: " & _
objItem.StorageLimitInfo

objOutputFile.Writeline "Store name: " & _
objItem.StoreName

objOutputFile.Writeline "Total items: " & _
objItem.TotalItems

objOutputFile.Writeline

Next

objOutputFile.Close

set objReadFSO = Nothing
set objOutputFile = Nothing
Set objWMIService = Nothing
Set colItems = Nothing

Wscript.Echo "All Done"