17.27. Mounting and Dismounting Mailbox Stores

Problem

You want to mount or dismount a mailbox store.

Solution

Using a graphical user interface

  1. Open the Exchange System Manager (ESM) snap-in.

  2. In the left pane, browse to the server and storage group that contains the mailbox store you want to manipulate.

  3. Right-click on the mailbox store and select Dismount Store.

  4. Click Yes when prompted to continue.

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."

Discussion

There 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 ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.