Solved

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

Posted on 2011-03-25
3
1,908 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
exchange 2013 4 43
Sending out with another email domain in Exchange 2010 3 17
exchange, outlook 8 58
exchange 2013 ecp no longer works 2 25
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Read this checklist to learn more about the 15 things you should never include in an email signature.
In this video we show how to create a User Mailbox 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 Recipients >> Mailb…
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…

910 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

16 Experts available now in Live!

Get 1:1 Help Now