Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-25
3
Medium Priority
?
1,975 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

916 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