Offline Defrag

Have an Exchange 2003 cluster.  We need to perform offline defrag and compression on the storage groups.  Now although this is a simple procedure using the ESEUTILS, we would like to automate the function if at all possible.  I know that we can create batch files with the appropriate ESEUTIL parameters and then use Windows scheduler to run them, but is there any way (batch file or other) to take the storage group offline and possibly remount, although this is really not a requirement since it would be completed by early morning/day?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't think it is possible to detach a 2003 exchange database from commanline, the new 2007 version has improved command line possibilities
...but it is possible with a VBscript:
Set oDB = CreateObject("CDOEXM.MailboxStoreDB")
strDB = "CN=Mailbox Store (E2K3),CN=First Storage Group,CN=InformationStore,CN=E2K3,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Exchange 2003,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=com"
oDB.DataSource.Open strDB

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frevereAuthor Commented:
Looking at ADSIEdit to get the required information, I can only go as far as the Storage Group.  Last I used the ESEUTIL, if I remember correctly you can only dismount the storage group, and not the mailbox store.  Is it possible to take just the mailbox store offline for maintenance?
frevereAuthor Commented:

will have to run 4 dismounts to take the entire storage group offline, then the batch, possibly vbs, can run the ESEUTILS, then remount the group by modifying the script you provided.  Tested this out on our test server.  Thanks for the help with the scripting.
Why on earth are you wanting to automate an offline defrag?  An offline defrag is not something that is designed for scheduled maintenance.

If you want to free up space, create a new storage group and move mailboxes to it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.