Scriptomatic Redux

Scriptomatic Version 2 improves upon some of the limitations of the previous iteration of this handy scripting tool.

Way back in January 2003, I told you about a cool tool that the Microsoft Scripting Guys put together called the "Scriptomatic"—a Hypertext Application (HTA) that actually wrote your Windows Management Instrumentation (WMI) scripts for you. Well, maybe that's overstating it a bit. It wrote WMI scripts, yes, but only to the point of listing out the properties of the specified WMI Classes.

Nevertheless, I was impressed and I continue to recommend it as a staple in any scripting toolkit.

After more than two years, the Scripting Guys have introduced Scriptomatic V2, which addresses some of the limitations in their first effort. Chief among them was the fact that the original Scriptomatic worked only with the root/CIMV2 namespace.

Not only does this new Scriptomatic provide much more flexibility and power than its predecessor (more on this in a moment), but coming on the heels of our series about HTAs it's an excellent example of the power of these little gems. (Talk about perfect timing!) I strongly encourage you to view Scriptomatic's VBScript source code to see what makes it tick. In the meantime, let's take a closer look at the improvements in the updated tool.

Very Classy
Back in early 2003, the root/CIMV2 namespace contained virtually all the classes you would need for Windows 2000 Server administration. Indeed, the only other namespace I found myself using on a regular basis was root/DEFAULT. Times have changed, and if you administer a bunch of Windows XP or Windows Server 2003 boxes, you'll need more than root/CIMV2 to do it effectively. Scriptomatic V2 works with all of the WMI namespaces installed on your computer, giving you access to billions of classes (OK, maybe not billions, but quite a few).

At initialization, Scriptomatic V2 loads all of the namespaces on the computer on which it's running.

It then defaults to root/CIMV2 and provides a drop-down list for selecting a class. You can change the namespace as well, but keep in mind that not every WMI namespace contains classes that can be used by Scriptomatic.

If you select a namespace that can't be used, the Scriptomatic will politely ask you to select another. Because I often use root/DEFAULT to script System Restore settings, let's see how this new Scriptomatic handles that namespace, shall we?

Figure 1 shows the script Scriptomatic generates. As you can see, the script cycles through every stored restore point and outputs the necessary information such as when it was created, the description, sequence number and so on.

Figure 1. Scriptomatic's generated script when using the root/DEFAULT namespace.
Figure 1. Scriptomatic generates this script when using the root/DEFAULT namespace to script System Restore settings. Note on the right that Scriptomatic V2 speaks four languages, three more than the original. (Click image to view larger version.)

Multilingual and More
Another big improvement in V2 is you can change the language of the generated script. In addition to VBScript, you can create scripts in JScript, Perl and Python. So if, for example, you're creating a WMI script that you want to include in a larger script written in JScript, you're all set. Simply click on the radio button next to JScript and the script is automatically re-written in that language.

Next, you can specify the output format. Because these auto-written scripts can potentially return a great deal of data, you can display that data in a console window, or save (and display) it in a text, HTML, Excel or XML file.

Yet another new feature is the ability to run scripts against multiple computers. When you start Scriptomatic, it retrieves your computer name and lists it in the Target Computers window. You can add more names by directly typing them into this area. The instructions say the list must be comma-delimited, but it will work if you use semi-colons, spaces or even if you put each computer name on a different line. Furthermore, if you have a text file with the list of computer names you want to use, you can load it into Scriptomatic by clicking the "Load From File" button. Regardless of how you get the names into Scriptomatic, you must remember to click the "Update Script" button whenever the list changes.

Before I send you off to play with your new scripting toy … err, I mean tool, I want to cover one final, very important feature. Those paying attention will remember I said that when the Scriptomatic initializes, it loads all the namespaces you have on your computer. That's all well and good if you use Windows 2003 as your workstation. But if you use XP or even Win2K Pro for a workstation, this listing might be missing a few namespaces you need for administering Windows 2003. This is where the "WMI Source" button becomes invaluable. Just click this button and enter a computer name when prompted. Scriptomatic will then load the WMI classes from that computer. Awesome!

It's a Two-fer
Not only does the new Scriptomatic help you write scripts to perform virtually any administrative task of which WMI is capable, it also showcases some of the powerful features of HTAs. With all of its new features, I'm amazed Microsoft is still giving this tool away. You'd better download yours now—before the company comes to its senses.

More Information

Recent HTA Columns:

The original "Scriptomatic" column (January 2003)

Download Scriptomatic here.