I'm a big fan of automation -- I think most administrators who have had the opportunity (and the time) to script
would probably agree.
The time spent scripting is usually paid off many times over when you get the script working and saving you time. The script example below is certainly nothing earth shattering, or even revolutionary for that matter, but it did provide an easy-to-use method to accomplish a task that concerns me: Keeping an eye on the Exchange Private Store size.
An organization I know was in the process of making final plans for a large corporate-wide migration. They were moving from a Windows NT 4.0 domain with Exchange Server 5.5 to a completely new Windows Server 2003 Active Directory domain with Exchange Enterprise Server 2003.
However, they had an Exchange Server 5.5 server that kept shutting down the Exchange Information Store service on a fairly regular basis. Soon enough this problem would be a thing of the past due to the unlimited database size in Exchange Enterprise Server 2003 and the very large capacity SAN the company already had in place. But what could they do in the meantime to keep an eye on that pesky Exchange 5.5 private store?
Each server shutdown resulted in approximately three hours of downtime between database copies and defragmentations using the eseutil utility. (For safety's sake the company's procedures dictated that a copy of the priv.edb file be made before eseutil was run and then again afterwards. The copy after running eseutil was so that a subsequent failure before the next backup--run daily at 3 a.m.--would not require the process to be repeated.)
While it's certainly not a large amount of work to manually monitor the size of the priv.edb file (so that offline defragmentation could be accomplished during non- production hours), anything that can make an already busy administrator's day a little easier is certainly welcome.
Enter VBScript. The simple script below checks the size of the priv.edb and lets you know how large it is--and thus how much time you have before you need to act.
' WSH script to check file size of Exchange Private Store
' Will Schmied
' Version 1.0.0, September 16, 2004
' Define the variables
Dim objFSO, objFile, strFileSpec
' Specify the file to check
' Be sure to provide the full file path, either absolute or UNC
' Example: \ \ECHSVR \G$ \EXCHSRVR \MDBDATA \PRIV.EDB
' Example: G: \EXCHSRVR \MDBDATA \PRIV.EDB
' Ensure the path is placed between the quotes
strFileSpec = "PATH TO PRIV.EDB FILE"
' VBS work area
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strFileSpec)
' Produce a useful output
WScript.Echo "The Exchange Private Store is " & objFile.Size/1073741824
& " GB" & vbNewLine & _
" (which is " & objFile.Size/1048576 & " MB)"
Will Schmied, BSET, MCSE, MCSA, is a messaging engineer for a Fortune 500 manufacturing company. He has written for Microsoft, Pearson, Sybex, Syngress, TechTarget and several other organizations. He has also worked with Microsoft in the MCSE exam-development process.
Do you have a useful Exchange tip to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.
Dig deeper on Microsoft Exchange Server Scripts and Programming