Another interesting script to get information exchange 2003 mailboxes, useful in audits, reports, etc …
'========================================================================== ' NAME : Exchange Mailbox Stats Dumper ' AUTHOR : Brian Desmond' DATE : 12/28/2005 ' COMMENT: This script requires Exchange 2003. It will dump information ' about each mailbox on the mailbox servers specified ' ' Version Date Author Note ' ----------------------------------------------------------------- ' 1.0 28Nov05 Brian Desmond Initial Version ' 1.1 03Sep06 Brian Desmond ' 1.2 13Dec08 Brian Desmond Fixed array sizing bug, ' Added error handling note ' Added TODOs ' Moved configurable items up '========================================================================== Option Explicit ' Note this script currently uses On Error Resume Next ' this isn't best practice - in reality this should be tightly ' wrapped around the WMI connection logic in the loop rather ' than up here. On Error Resume Next ' TODO: Configure this ' This is the total number of servers which you ' will specify for inventory Const TOTAL_SERVERS = 1 Dim strComputer() ReDim strComputer(TOTAL_SERVERS) ' TODO: Populate this array ' Enter each server name below as an entry in the array ' starting with zero strComputer(0) = "xxb01" strComputer(1) = "xmb02" strComputer(2) = "xmb03" '========================================================================== Dim objWMIService Dim colItems Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim fil Set fil = fso.CreateTextFile("mailboxes.txt") Dim objItem Dim line Dim i ' Write a header row to the CSV fil.WriteLine """Server"",""Storage Group"",""Mail Store"",""Mailbox GUID"",""Display Name"",""LegacyDN"",""Size"",""Item Count"",""Associated Content Count"",""Deleted Message Size"",""Date Absent"",""Storage Limit Level""" For i = 0 To TOTAL_SERVERS - 1 Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer(i) & _ "\ROOT\MicrosoftExchangeV2") Set colItems = objWMIService.ExecQuery _ ("Select * from Exchange_Mailbox") For Each objItem in colItems line = """" & objItem.ServerName & """" line = line & "," line = line & """" & objItem.StorageGroupName & """" line = line & "," line = line & """" & objItem.StoreName & """" line = line & "," line = line & """" & objItem.MailboxGUID & """" line = line & "," line = line & """" & objItem.MailboxDisplayName & """" line = line & "," line = line & """" & objItem.LegacyDN & """" line = line & "," line = line & """" & objItem.Size & """" line = line & "," line = line & """" & objItem.TotalItems & """" line = line & "," line = line & """" & objItem.AssocContentCount & """" line = line & "," line = line & """" & objItem.DeletedMessageSizeExtended & """" line = line & "," line = line & """" & objItem.DateDiscoveredAbsentInDS & """" line = line & "," line = line & """" & objItem.StorageLimitInfo & """" fil.WriteLine line 'WScript.Echo line Next Next fil.Close Set fso = Nothing Set objWMIService = Nothing