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
Free Online Event! Virtualization:Get the Facts! Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!
Ease Your Scripting Pains with the Flexibility of PowerShell! Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!
Latest Advancements in SSL Technology There are a variety of different kinds of SSL to explore to ensure customer data is kept confidential and secure. In this paper, we will discuss some of these SSL advances to help you decide which would be best for your organization.
Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.
Maximize Your SharePoint Investment: Get Your Data Moving Watch this web seminar now to learn how to maximize your SharePoint investment! Join us as we take a look at the complex business of securing, accessing and managing vast amounts of information in a global network and various ways to get your data moving.