Free Whitepaper: High Availability and Disaster Recovery for Exchange! Saving Time and Money with Network Faxing =============== 1. Commentary 2. Resources 3. New and Improved ~~~~ Sponsor: Neverfail ~~~~ Free Whitepaper: High availability and disaster recovery for Exchange! Editor's note: Share Your Exchange Discoveries and Get $100 ==== 1. Commentary: Mounting and Dismounting Databases with CDOEXM ==== I spend a fair amount of time reading the Microsoft public support Exchange newsgroups, where many of the same questions are asked over and over. This year I'd like to occasionally answer some of the more obscure questions in this column. This week, I decided to start with a real winner: How do you programmatically mount and dismount Exchange Server 2003 and Exchange 2000 Server databases? This task is fairly simple, but unless you spend a lot of time spelunking in the Microsoft Developer Network (MSDN) Collaboration Data Objects for Exchange Management (CDOEXM) documentation, you might not be aware of it. Here's a short script, in pieces, that mounts a mailbox database. The first piece of code defines the server (batman) and mailbox database ("Mailbox Store (BATMAN)"). It also creates two CDOEXM objects: The ExchangeServer object is used later, and the MailboxStoreDB object is used to mount and dismount the database. strServerName = "batman" The next piece of code connects to the server and finds the first storage group (SG). The StorageGroups property of the ExchangeServer object lists all the SGs on that server. VBScript doesn't have a good way to find the first item in a collection, which is why the code starts a "for each" loop, then immediately exits. theServer.DataSource.Open strServerName After you have the name of the first SG, mounting the store is a simple matter of constructing a URL to the database from a combination of the SG name and the database name, then using that URL to open the message database (MDB) object. After the object is open, you can mount or dismount it using the Mount and Dismount CDOEXM methods. strURL = "LDAP://" & theServer.DirectoryServer & "/cn=" & strMDBName & "," & theFirstSG ~~~~ Sponsor: Esker Software ~~~~ Saving Time and Money with Network Faxing ==== Announcements ==== Are You a Hacker Target? Get David Chernicoff's Essential Guide to Blade Servers Managing and Securing Corporate Email Forum: January 31 – February 2, 2004, Harrah's, Las Vegas Is Your Messaging Infrastructure Ready for Tomorrow's Risks? ==== 2. Resources ==== Featured Thread: Public Folders and External Email Outlook Tip: Customizing the Outlook 2003 Form ==== Events Central ==== True High-Availability for Microsoft Exchange Web Seminar--February 3 ==== 3. New and Improved ==== Automate Exchange Backup and Restoration ==== Sponsored Links ==== Data Protection from NSI and Microsoft ~~~~ Contact Us ~~~~ About the newsletter -- [email protected] This email newsletter is brought to you by Exchange & Outlook Administrator, the leading publication for IT professionals managing, securing, optimizing, and migrating Exchange and Outlook. Subscribe today! Manage Your Account You received this email message because you subscribed to this newsletter on our Web site. To unsubscribe, click here: View the Windows IT Pro Privacy policy at http://www.windowsitpro.com/AboutUs/Index.cfm?action=privacy Windows IT Pro a division of Penton Media Inc.
==========
==========
==========
==========
strMDBName = "Mailbox Store (BATMAN)"
Set theServer = CreateObject("CDOEXM.ExchangeServer")
Set theMDB = CreateObject("CDOEXM.MailboxStoreDB")
For Each sg In theServer.StorageGroups
theFirstSG = sg
Exit for Next
theMDB.DataSource.Open strURL
theMDB.Mount
==========
=========
===============
About technical questions -- http://www.windowsitpro.com/forums
About product news -- [email protected]
About your subscription -- [email protected]
About sponsoring UPDATE -- [email protected]
Copyright 2005, Penton Media, Inc. All Rights Reserved.
Exchange & Outlook UPDATE, Exchange Edition, January 6, 2005
0 comments
Hide comments