' 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 dismounts the selected database and moves it to the ' designated path. ' ------ SCRIPT CONFIGURATION ------ strServerName = "" ' e.g. "BATMAN" strMDBName = "" strNewPath = "c:\temp\" ' ------ END CONFIGURATION --------- Set theServer = CreateObject("CDOEXM.ExchangeServer") Set theMDB = CreateObject("CDOEXM.MailboxStoreDB") theServer.DataSource.Open strServerName ' Get the array list of StorageGroups, then coerce it to get the first ' SG name theSGArr = theServer.StorageGroups theFirstSG = theSGArr(0) strURL = "LDAP://" & theServer.DirectoryServer & "/cn=" & strMDBName & "," & theFirstSG theMDB.DataSource.Open strURL ' dismount the database before attempting to move it If (theMDB.Status= 0) then theMDB.Dismount End If ' move the DB to the specified path, then remount it theMDB.MoveDataFiles strNewPath & strMDBName & ".edb", strNewPath & strMDBName & ".stm" WScript.Echo "Moved data files for " & strMDBName & " to " & strNewPath theMDB.Mount WScript.Echo "Mounted " & strMDBName