Solved

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

Posted on 2011-03-25
3
1,893 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
3 Comments
 
LVL 12

Expert Comment

by:Saakar
Comment Utility
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
Comment Utility
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
Comment Utility
Awesome! Worked like a charm! :) Thanks so much!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Easy CSR creation in Exchange 2007,2010 and 2013
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now