Command Line Store Dismount
It's quite common for people to ask how you dismount a mailbox or public folder store from a command line.
There's actually no direct command line utility to do this, but it is extremely easy via a small piece of VBScript that makes use of CDOEXM. Copy and paste the code below into notepad and save it as dismount.vbs or another suitable name. You will need to modify the parts of the code that are in bold, since these parts will be specific to your environment. I will explain what each part is after the code listing.
Set oDB = CreateObject("CDOEXM.MailboxStoreDB")
strDB = "CN=Mailbox Store (E2K3),CN=First Storage Group,CN=InformationStore,CN=E2K3,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Exchange 2003,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=com"
oDB.DataSource.Open strDB
oDB.Dismount()
The important line of the code is the second line, as this identifies the store that you wish to dismount. Here I list the parts of the example code above that you will need to change to suit your environment. Leave all other parts as per the code above.
CN=Mailbox Store (E2K3)
Change this to reflect the display name of the mailbox or public folder store you wish to dismount. In this example, we're dismounting the default mailbox store created on a server named E2K3.
CN=First Storage Group
Here you'll need to enter the name of the storage group that contains the mailbox or public folder store you wish to dismount.
CN=E2K3
This is the name of the server on which you wish to perform your dismount action.
CN=First Administrative Group
Change this to reflect the name of the administrative group in which the affected server resides.
CN=Exchange 2003
This is the name of the Exchange organisation.
DC=domain,DC=com
Here you'll need to enter your Active Directory domain name.
Of course, once you've dismounted your store you'll need to mount it again at some point, otherwise your users won't be able to log into their mailboxes. For this task, just create another VBScript file using the above code but change the last line to read as follows:
oDB.Mount()
And there you go. It's as easy as that.
Neil Hobson on December 10, 2003 at 01:45 PM
« WiFi BlackBerry Likely to be Launched Next Year |
Main
| Exchange 2003 Performance Whitepaper Published »
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8345191a569e200e5503440738834
Listed below are links to weblogs that reference Command Line Store Dismount:
» Command Line Store Dismount from Phil's NewsPhlash
Now this is cool for those folks who like to do flat-file backups… It's quite common for people to ask how you dismount a mailbox or public folder store from a command line. There's actually no direct command line... [Read More]
Tracked on Dec 11, 2003 1:10:33 PM
Comments
I tried this and got an invalid argument error
Posted by: Joe Schmeier at Apr 26, 2004 11:41:59 AM
Works perfectly, thanks.
Posted by: Hog at May 24, 2004 1:49:57 PM
Does anyone have the equivalent code in c++ ?
Posted by: Patrick Télégone at Oct 27, 2004 9:05:13 AM
It works perfect too on our Exchange 2000 servers. Thanks a lot.
Posted by: Bruce Kong at Nov 27, 2004 9:01:47 PM
Anyone know of a vbscript way to enumerate the storage group names?
Thanks,
Tim
Posted by: Tim at Nov 29, 2004 9:28:33 AM
This worked perfectly and saved me a tedious chore of doing this manually. Thanks a million!
Posted by: Phil Cox at Dec 16, 2007 12:11:26 PM
Thank you
Works perfect for my Mailbox store but I can't seem to get the syntax right for my public folder store. I changed "Mailbox Store (E2K3)" to "Public Folder Store (SERVERNAME)" and get an invalid argument error. If I try any other name for the public folder store I get "No such object exists on server".
Posted by: John at Jun 18, 2009 10:50:55 AM
To access public stores, change the first from from:
Set oDB = CreateObject("CDOEXM.MailboxStoreDB")
to
Set oDB = CreateObject("CDOEXM.PublicStoreDB")
Everything else remains the same.
Posted by: Austin at Jul 9, 2009 8:28:10 AM
I don't understand:
DC=domain,DC=com
My domain is: CIESSE.local
Posted by: Francesco at Jul 18, 2009 4:04:27 AM
DC=CIESSE,DC=local
Posted by: Jason at Jul 30, 2009 8:52:24 AM
I have seen this script on several sites but can not seem to get it to work, each time I get a error on Line 5 Char 1 Stating There is no such object on the server.
Database = Termed_Emps
Server Name = HoarEXCH1
Storage Group Name = System
First Administrative Group = First Administrative Group
organization = Hoar
AD domain name = Hoarllc.loc
Here is my code What am I missing?
Set oDB = CreateObject("CDOEXM.MailboxStoreDB")
strDB = "CN=Termed_Emps (HOAREXCH1),CN=System,CN=InformationStore,CN=HOAREXCH1,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Hoar,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=hoarNT,DC=com"
oDB.DataSource.Open strDB
oDB.Dismount()
Posted by: Tim at Aug 18, 2009 8:54:35 AM
I am also having trouble getting this to work.
Get the same message as the above post, can't seem to find which tree variable I have out of whack.... :(
Posted by: Nate at Sep 4, 2009 11:58:36 AM
DC=hoarNT,DC=com appears to be incorrect.
If AD Domain is Hoarllc.loc then it should be DC=Hoarllc,DC=loc
This is from the Author's notes on the script:
'DC=domain,DC=com
Here you'll need to enter your Active Directory domain name'
Posted by: hamish at Oct 18, 2009 5:45:42 PM
Hi !
The easiest way to find the values corresponding to your setup is to launch adsiedit.msc and to follow the tree under CN=Configuration
hope this helps
Posted by: grumo at Dec 24, 2009 7:10:28 AM
