Recipe6.3.Enumerating the Storage Groups on a Server


Recipe 6.3. Enumerating the Storage Groups on a Server

Problem

You want a report that shows you what storage groups exist on your server, and where their database and log files are located.

Solution

Using a graphical user interface

  1. Launch the Exchange System Manager (Exchange System Manager.msc).

  2. In the left pane, expand the appropriate Administrative Groups container, and then expand the Servers container.

  3. Select the target server.

  4. Right-click on a storage group and choose Properties. The General tab of the Storage Group Properties dialog box will display the system file and log file locations. Click OK to dismiss the properties dialog.

  5. Repeat step 4 for each additional storage group on the server.

Using VBScript
' This code lists all of the storage groups, and databases within them, ' on the target server.  ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>" ' e.g., "batman" ' ------ END CONFIGURATION ---------      set theServer = CreateObject("CDOEXM.ExchangeServer")   Set theSG = CreateObject("CDOEXM.StorageGroup")   Set thePF = CreateObject("CDOEXM.PublicStoreDB")   Set theMB = CreateObject("CDOEXM.MailboxStoreDB")   theServer.DataSource.Open strComputerName      ' examine the SGs; for each SG, list its associated stores and paths    For Each sg In theServer.StorageGroups       WScript.Echo "Storage group " & Chr(34) & sg & Chr(34)       theSG.DataSource.open sg       i = 0       For Each mailDB In theSG.MailboxStoreDBs         i = i+1         WScript.Echo "  Mailbox database " & i & ": " & mailDB         theMB.DataSource.open mailDB         WScript.Echo "                     Name:" & theMB.name         WScript.Echo "                     Path:" & theMB.DBPath       Next       i = 0      For Each pubDB In theSG.PublicStoreDBs         i = i+1         WScript.Echo "       PF database " & i & ": " & pubDB         thePF.DataSource.open pubDB         WScript.Echo "                     Name:" & thePF.Name         WScript.Echo "                     Path:" & thePF.DBPath       Next    Next

Discussion

SGs have a variety of properties available through CDOEXM, including the names (both common and distinguished) of databases in the SG and the log and database file paths for the databases. You can view and set these properties by using code like that shown in the solution; however, you won't be able to change the log or database file locations by changing the associated properties. Instead, you'll have to use the MoveLogFiles( ) and MoveSystemFiles() methods (see Recipe 6.9).

See Also

Recipes Recipe 6.1 and Recipe 6.2 for creating and deleting storage groups and Recipe 6.9 for moving databases and log files; MSDN: IStorageGroup class documentation



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net