When I was in college, I had the good fortune to take several computer science classes from one of Georgia Tech's legends, a man named gus Baird (his real name was Augustus, and he insisted that the g in gus be lower case). gus was a terrific instructor. Among the basic principles he taught was a simple one: Hard-working programmers solve problems, but good programmers solve their problems once by writing tools to automate repetitive tasks. The release of the new version of Scriptomatic from the Microsoft Scripting Guys (see http://www.microsoft.com/technet/scriptcenter ) reminded me of gus's maxim. Scriptomatic automates the process of writing several different kinds of WMI scripts, which has two benefits. For new scripters, it drastically lowers the difficulty of using WMI; for experienced scripters, it provides a simple way to crank out new scripts from a known set of basic scripts.
After you download the Scriptomatic 2.0 from http://www.microsoft.com/downloads/details.aspx?familyid=09dfc342-648b-4119-b7eb-783b0f7d1178&displaylang=en and install it, you'll find that you've suddenly gained the ability to create about multiple types of scripts. The original Scriptomatic could produce only VBScript code, but the new version can write scripts in the popular Perl and Python scripting languages, as well as in JavaScript. Better yet, you can easily target a single script at multiple computers, giving you an easy way to write one script that automatically gathers data from all your Exchange servers. Best of all, you can choose the output format for the script's data. The default dumps data on the command line, but you can also output plain text, HTML, Microsoft Office Excel, or XML format data to a file.
How easy is Scriptomatic to use? Check out the script I created (see below), which displays all the properties of the DSAccess objects exposed by Windows Management Instrumentation (WMI) on my two Exchange servers. Here's how I did it: 1. I launched Scriptomatic from BATMAN. 2. I clicked on the WMI Namespace pull-down menu and selected root\MicrosoftExchangeV2. (The list of namespaces and classes are dynamically generated according to the providers installed on the machine on which you're running Scriptomatic.) 3. From the WMI Class pull-down menu, I selected Exchange_DSAccessDC. 4. In the Target Computers field, I entered SUPERMAN as a computer name. 5. I clicked Update Script, then Run. Total: six clicks and eight keystrokes.
The script itself is easy to read. Admittedly, it doesn't do anything except echo the properties of the selected object, but if you don't already know the names and types of the properties in a particular class, using the script is an easy way to find out. With a little tweaking, you could easily turn this script into a tool that could report back on the current DSAccess configuration for all the servers in an domain, Exchange organization, or organizational unit (OU).
We won't see the scripting improvements promised for Exchange 12 for a while yet. In the meantime, you'll probably be surprised at how much data you can gather (and how many settings and behaviors you can change) using WMI. Scriptomatic and the related resources at the Scripting Center are a great way to get started with Exchange scripting.
On Error Resume Next
Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20
arrComputers = Array("BATMAN","superman") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftExchangeV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Exchange_DSAccessDC", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems WScript.Echo "Caption: " & objItem.Caption WScript.Echo "ConfigurationType: " & objItem.ConfigurationType WScript.Echo "Description: " & objItem.Description WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate) WScript.Echo "IsFast: " & objItem.IsFast WScript.Echo "IsInSync: " & objItem.IsInSync WScript.Echo "IsUp: " & objItem.IsUp WScript.Echo "LDAPPort: " & objItem.LDAPPort WScript.Echo "Name: " & objItem.Name WScript.Echo "Status: " & objItem.Status WScript.Echo "Type: " & objItem.Type WScript.Echo Next Next
You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor?
Register now
An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...
Let Your Users Reset Their Own Passwords: Free Download Try a 30 day free trial of Desktop Authority Password Self-Service – it provides an easy-to-use, robust system for allowing users to reset their own forgotten passwords or locked accounts.
Get Windows IT Pro & Mark Minasi’s Favorite Power Tools Guide Order Windows IT Pro now and get "More of Mark Minasi's Favorite Power Tools"--a in-depth guide to the most useful Windows commands --FREE with your paid order! Subscribe today, and save 58% off the cover price!
Deep Dive into VMware vSphere, eLearning Series Join John Savill to explore the major functionality capabilities of the vSphere virtualization platform, including identification of the changes from ESX 3.5.