Recipe 17.27. Mounting and Dismounting Mailbox StoresProblemYou want to mount or dismount a mailbox store. SolutionUsing a graphical user interface
Using VBScript' This code mounts/dismounts a Mailbox Store. ' ------ SCRIPT CONFIGURATION ------ strServer = "<Exchange Server>" ' e.g., ExchServer2 strSGName = "<Storage Group Name>" ' e.g., SG1 strMailStoreName = "<Database Name>" ' e.g., DB1 ' ------ END CONFIGURATION --------- ' Find Storage Group URL strSearch = "CN=" & strSGName & "," set objSrv = CreateObject("CDOEXM.ExchangeServer") objSrv.DataSource.Open strServer for each sg in oSrv.StorageGroups if (instr(1,sg,strSearch,1)>0) then strSGUrl = sg next ' Generate Mailbox Store URL strMBUrl = "LDAP://CN=" & strMailStoreName & "," & strSGUrl ' Open Mailbox Store set objMb = CreateObject("CDOEXM.MailBoxStoreDB") objMb.DataSource.Open strMBUrl if (objMb.Status = 0) then Wscript.Echo "Mailbox store is mounted, dismounting..." objMb.Dismount else Wscript.Echo "Mailbox store is dismounted, mounting..." objMb.Mount end if Wscript.Echo "Script completed successfully." DiscussionThere will be times that you need to dismount a mailbox store on the fly. This could be for integrity checking, mailbox restorations, or to make email unavailable to some users for some reason. When you dismount a mailbox store, users with mailboxes in that store will be unable to retrieve their mail; users with mailboxes in other mailbox stores will be unaffected.
Using a graphical user interfaceWhen a store is stopped, it has a white circle with a red downward pointing arrow over the normal mailbox store icon. Using VBScriptThe mailbox store mount/dismount script shows off three basic functions: how to check status of a mailbox store, how to mount, and how to dismount. Once again, the method to get the mailbox store URL can vary between the three methods mentioned in Recipe 17.11 and Recipe 17.16. See AlsoMS KB 314211 (HOW TO: Make a Data Store Temporarily Inaccessible to Users in Exchange 2000 Server) and Exchange Server 2003 SDK: WMI Reference |