Solved

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
To show how to generate a certificate request 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 >> Certificates…
This video discusses moving either the default database or any database to a new volume.

770 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