List Storage Group (VBScript)

This code can be found in Chapter 6 of Exchange Server Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux, 
' Missy Koslosky, and Devin Ganger. Redistributed with permission 
' of the publisher, O'Reilly & Associates.

' This script lists all of the storage groups on the specified server.
' For each SG, it lists information on the SG, including its
' database stores and their paths.

' ------ 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 & ": " & mailDB
        thePF.DataSource.open pubDB
        WScript.Echo "                     Name:" & thePF.Name
        WScript.Echo "                     Path:" & thePF.DBPath
      Next
 
   Next
   

This code has been viewed 2014 times.

New from the creators of TechTasks.com: StatSheet.com