Solved

How to Mount Exchange 2003 Mailstore database using a .VBS script

Posted on 2011-03-25
3
1,954 Views
Last Modified: 2012-05-11
I was wondering if someone could help me with a VBS script that could mount a mailbox store?

Currently we have a client who's edb and stm files exceed well over 75GB. They are going to upgrade to Exchange 2010 in the relatively near future (we're in process of virtualizing their servers).

The reason I need a script is so that I can schedule it to run every other day when the mailbox store is dismounted promptly at 5AM. Any help? I have very little experience in scripting and am currently installing a test VM of exchange 2003 for testing purposes.
0
Comment
Question by:Timothy McCartney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:Saakar
ID: 35216963
There is no VBS as far as I know you can try scheduled tasks and see if that helps
0
 
LVL 14

Accepted Solution

by:
yehudaha earned 500 total points
ID: 35226308
edit values from line 8 to 13 to match your needs

try this:
quot = chr(34) 

Set iServer = CreateObject ("CDOEXM.ExchangeServer")
Set iMDB = CreateObject ("CDOEXM.MailboxStoreDB")

strMode = "mount"
'************** edit from here ************
strComputerName = "ServerName"
'storage name
strSGName = "First Storage Group"
'name of the store
strMDBName = "StoreName"
'********* end editong
BindMailboxStore strComputerName,strSGName,strMDBName
Select Case strMode
Case "mount"
wscript.echo "Mounting Database " & strMDBName & " in Storage Group " & strSGName & " on " & strComputerName
iMDB.mount
Case "dismount"
wscript.echo "Dismounting Database " & strMDBName & " in Storage Group " & strSGName & " on " & strComputerName
iMDB.dismount
Case "delete"
wscript.echo "Deleting Database " & strMDBName & " in Storage Group " & strSGName & " on " & strComputerName
iMDB.DataSource.delete
End Select

' Cleanup
Set iServer = Nothing
Set iMDB = Nothing

Sub BindMailboxStore (strComputerName,strSGName,strMDBName)
' Bind to the Exchange Server
iServer.DataSource.Open strComputerName

' Build the first part of the URL to the MailboxStoreDB
strTemp = "LDAP://" & iServer.DirectoryServer & "/" & "cn=" & strMDBName & ","

' Set variant array to the ExchangeServer.StorageGroups
arrStGroup = iServer.StorageGroups

' Look in the StorageGroups array if the StorageGroup with strSGName exists
If strSGName = "" Then
' Add last part to the URL to the MailboxStoreDB
strMDBUrl = strTemp & iServer.StorageGroups(0)
Else
For i = 0 To UBound(arrStGroup)
If InStr(1, UCase(arrStGroup(i)), UCase(strSGName)) <> 0 Then
strMDBUrl = arrStGroup(i)
End If
Next
If strMDBUrl <> "" Then
' Add last part to the URL to the MailboxStoreDB
strMDBUrl = strTemp & strMDBUrl
End If
End If
' Bind to the MailboxStoreDB
iMDB.DataSource.Open strMDBUrl ', , , adCreateOverwrite
End Sub

Open in new window

0
 
LVL 9

Author Closing Comment

by:Timothy McCartney
ID: 35232193
Awesome! Worked like a charm! :) Thanks so much!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses
Course of the Month4 days, 2 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question