#186827 - 2008-04-10 01:03 PM
Re: Need to count mail enabled objects in mailstores
[Re: Richard H.]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here is an example of what I mean.
This script enumerates all AD objects, and displays the information for those objects which have a mail store defined.
You can take this as a starting point and add code to summarise by whatever field you fancy.
If you don't want to tackle the additional code just change the output so that it is suitable to import into Excel as a CSV file and sort / summarise in Excel.
$=SetOption("WrapAtEOL","ON") BREAK on
$objConnection = CreateObject("ADODB.Connection") $objCommand = CreateObject("ADODB.Command") $objConnection.Provider = "ADsDSOObject" $objConnection.Open("Active Directory Provider") $objCommand.ActiveConnection = $objConnection
$objCommand.CommandText = "SELECT Name,homeMDB FROM " + "'LDAP://" + GetObject("LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")).distinguishedName + "'"
$objCommand.Properties("Page Size").Value = 100 $objCommand.Properties("Search Scope").Value = 2 $objCommand.Properties("Cache Results").Value = (not 1)
$objRecordSet = $objCommand.Execute() $objRecordSet.MoveFirst while not $objRecordSet.EOF If $objRecordSet.Fields("homeMDB").Value $objRecordSet.Fields("Name").Value+@CRLF
" Exchange Server: "+Split($objRecordSet.Fields("homeMDB").Value,",")[3]+@CRLF " Storage Group: "+Split($objRecordSet.Fields("homeMDB").Value,",")[1]+@CRLF " Mail Store: "+Split($objRecordSet.Fields("homeMDB").Value,",")[0]+@CRLF @CRLF EndIf $objRecordSet.MoveNext Loop
Exit 0
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 248 anonymous users online.
|
|
|