Recipe6.2.Deleting a Storage Group


Recipe 6.2. Deleting a Storage Group

Problem

You want to delete a storage group on an Exchange server.

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. Expand the server that contains the target storage group.

  4. Right-click the storage group and choose Delete.

  5. Click Yes in the confirmation dialog.

Using VBScript
' This code deletes the selected storage group.  ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>" ' e.g., "batman"  strSGName = "<storageGroupName>" ' e.g., "New Storage Group" ' ------ END CONFIGURATION ---------      set theServer = CreateObject("CDOEXM.ExchangeServer")   Set theSG = CreateObject("CDOEXM.StorageGroup")   theServer.DataSource.Open strComputerName      ' examine the SGs and see if we can find ours. This code will   ' delete any SG whose name contains strSGName, so be careful!    For Each sg In theServer.StorageGroups       WScript.Echo "Examining " & sg       isIn = InStr(1, UCase(sg), UCase(strSGName))       If (isIn<>0) Then          wscript.echo "Deleting " & sg          theSG.DataSource.Open "LDAP://" & theServer.DirectoryServer & "/" & sg         ' delete the storage group         theSG.DataSource.Delete          WScript.Echo "Deleted SG " & sg          End if    Next

Discussion

Unlike mailbox or public databases, the SG object itself doesn't really have any useful data in it; it's a container that points to a set of transaction logs and databases. Accordingly, when you remove it, the corresponding directory object is removed but nothing changes on the target server's filesystem. You can easily recreate a deleted SG, since the databases and log files are left intact (but orphaned) when you delete the SG itself.

You must first delete (or move) any mailbox or public folder stores that are housed in the SG. If you attempt to delete a SG that still contains active databases, ESM will complain; if you're doing it from within a script, the script will fail.

See Also

Recipe 6.1 for creating storage groups, Recipe 5.6 for moving mailboxes, Recipe Recipe 6.6 for deleting databases, and MSDN CDOEXM 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