The world-famous Scriptomatic 2.0 is the utility that writes
WMI scripts for you. Not only that, but it teaches you the fundamental concepts
behind writing WMI scripts for yourself. If you’re new to Scriptomatic, you’ll
definitely want to try it out and see what you’ve been missing. If you’re
already familiar with Scriptomatic 1.0 you know how useful this tool can be.
Version 2.0 is even better; it has a lot of new features, including the ability
to create scripts in multiple scripting languages.
Download
Scriptomatic 2.0 now! Oh, wait, you should read the rest of this first.
There’s a lot of information in here—some of it is even helpful.
A Brief History Lesson
Throughout most of history people were much easier to please
than they are now. For example, it’s unlikely that anyone ever went up to Luke
the evangelist and said, “One Gospel? Come on, Luke. I mean, Matthew, Mark,
John – anybody can write one Gospel.” Upon being introduced to someone
at a cocktail party Neil Armstrong probably never had to hear, “Oh, first man
on the moon? I see ….” Did anyone ever say to the Pharaoh Cheops, “Well,
it’s a good pyramid, Cheops, but I don’t know about a great
pyramid ….” Of course they didn’t.
Well, not if they knew what was good for them, anyway.
Today it’s a bit different: not only are people notoriously
hard to please, but even if you do have a success there’s no guarantee
that anyone will be satisfied. After all, nothing is worse than being labeled a
one-trick pony, a one-hit wonder, or a flash-in-the-pan. We remember William
Shakespeare, but only because he wrote hundreds of plays and sonnets. Who
remembers the rock duo Mouth and McNeal? Nobody. And that’s because Mouth and
McNeal had one hit song, and then were never heard from again. Stephen King
will be remembered forever because of his prolific productivity, but does
anyone out there have the slightest idea who wrote the Epic of Gilgamesh?
Well, OK, it probably was Stephen King. Then what
about – right, he probably wrote that, too. But you know what we mean.
The One-Hit Wonders of Scripting?
Now, to be honest, we Microsoft Scripting Guys were never
too concerned about being one-hit wonders; after all, you can’t be a one-hit
wonder unless you first have a hit. We were sure nobody would ever hear of us,
and somehow that seemed better than being remembered and then just as quickly
forgotten. Remember baseball’s Joltin’ Joe Charboneau? Exactly.
But then we made a terrible mistake: we released the
original Scriptomatic – the amazing utility that actually wrote WMI scripts for
you – and it turned out to be a hit. That was not intentional, by the way. The
Scriptomatic was originally thrown together when one of the Scripting Guys was
looking for a socko-boffo ending for a WMI presentation he had to make for an
internal Microsoft audience. Literally minutes before the presentation was to
begin, he created something called the Scriptomatic, an HTA (HTML Application)
that could write rudimentary WMI scripts. He showed off his new creation at the
end of the talk, and the response was both overwhelming and unanimous; as noted
in the official annals of the Scripting Guys, everyone in the room stood up as
one and said, “Can we go now?” Not the most auspicious debut a piece of
software has ever had, though it probably still tops the reception accorded
Microsoft Bob.
Note. If you’re a Microsoft employee who liked
Microsoft Bob, we’re just kidding. In fact, some of our best friends
used Microsoft Bob.
Well, at least we think they did. It’s hard to get
people to admit to something like that.
But back to our story. As it turned out, something weird
happened when we released that same Scriptomatic on Microsoft.com: it became a
hit, or at least as close to being a hit as any scripting-related utility will
ever come. As of today, the Scriptomatic has been downloaded by nearly 500,000
people, a number which warms the cockles of our hearts, and also makes us
wonder why we didn’t charge people $1 per download.
But while it was great that everyone found the Scriptomatic
useful, its unexpected success put us in the position of being the computer
world equivalent to Dexy’s Midnight Runners. Now we had to create a follow-up
success of some kind. But what? The Beatles didn’t have to worry about being
one-hit wonders because they were really good at what they did. Ernest
Hemingway didn’t have to worry about being labeled a flash-in-the-pan; after
all, he was good at what he did. But where did that leave the Microsoft
Scripting Guys?
Life as a Has-Been
We pondered this problem of being a one-hit wonder long and
hard, for many, many months, and without much success. Not for lack of trying,
mind you, but to be honest, most of our efforts were for naught. In retrospect,
reading all our scripts out loud and recording them onto an MP3 player we
called the scriptPod might not have been such a good idea after all. (Of
course, it probably would have helped had we remembered to put a Play
button on the scriptPod. And maybe we should have taken the rock group U2 up on
their offer after all.)
Likewise, we probably should have tested the waters with a
single Scriptbucks rather than blithely opening a chain of coffee houses across
the country, all of them serving script-flavored lattes. (In our defense, a
number of people have told us that the ADSI Mocha Fudge Delight wasn’t that bad
as long as you added sugar and cinnamon, stirred well, spritzed a little
whipped cream on top, and then poured the whole thing down the drain without
drinking it. As an added bonus, it could unclog that drain in no time!)
And while we haven’t given up on our reality TV show, The
Scripting Life, we are having problems getting either Paris Hilton
or Nicole Ritchie to return our calls. (And thanks to various court orders,
injunctions, and restraining orders, we’re no longer allowed to contact them.)
Coming up with a follow-up success turned out to be much harder than we
expected.
The Comeback
But then one day, inspiration struck. It occurred to us
that, instead of copying someone else’s ideas, we should do what we do
best. And while we don’t do very many things well at all, there was one thing
that we were good at: writing Scriptomatics. Therefore, the solution to
our problem was obvious: if we had a hit with one Scriptomatic, then logically
we’d have an even bigger hit if we released another Scriptomatic. It would
be just like the Star Wars saga, only with scripts instead of light
sabers.
Actually, our original plan was to emulate the Coca-Cola
company, which a few years back released New Coke, a product that met with
almost universal disdain. Needless to say, things looked grim, but then some
unsung genius at Coca Cola had a brainstorm: they suggested that the company do
nothing more than bring back the old Coke, now christened Classic Coke. And
guess what? It was a huge success! We figured, OK, we’ll do the same thing.
We’ll write a piece of software that nobody likes and release it as New
Scriptomatic. We’ll let people grumble and complain for awhile, and then we’ll
bring back the old Scriptomatic (or Classic Scriptomatic) and everyone will
love it! We’ll be heroes, and – best of all – we won’t have to do any work.
In the end, though, we decided to create a brand new version
of the Scripotmatic, one that actually worked: Scriptomatic 2.0.
Read "The
Real Story of New Coke"
Scriptomatic 2.0 Q & A
To celebrate the release of the new Scriptomatic 2.0, we
decided to hold a make-believe press conference. Here’s the transcript from
that press conference.
New Features
Question: So what’s so great about Scriptomatic 2.0?
Answer: …….
Question: Could you speak into the microphone please?
Answer: Oh, sorry; we don’t do many press
conferences. What’s great about Scriptomatic 2.0 is that it not only fixes some
problems inherent in Scriptomatic 1.0, but it also introduces some really cool
new features.
Question: There were problems with Scriptomatic 1.0?
Answer: No, of course not. It’s just that, for
example, one of the … features … of Scriptomatic 1.0 was the way it handled
properties that were stored as arrays: it just ignored them. Another feature
was the way Scriptomatic 1.0 dealt with dates and times: it displayed them in
UTC format, so you got output like 20040930083722.000000-480. In Scriptomatic
2.0, these … features … have been changed. Scriptomatic 2.0 now handles arrays
without any problem, and now displays dates and times as, well, dates and
times.
Question: Wow, that alone makes Scriptomatic 2.0 a
worthy successor to the original.
Answer: You know, that’s what we thought, too.
But our managers decided we were just being lazy, and so they made us go back
and add a bunch of other features to Scriptomatic 2.0 as well.
Question: Really? What kind of features?
Answer: Oh, there are so many of them it’s hard to
know where to begin. But here are some of the highlights:
- Scriptomatic 2.0 now works with all the WMI
namespaces on your computer. The old version only worked with the root\cimv2
namespace. That was fine for Windows 2000 computers, but just didn’t cut it
with Windows XP or Windows Server 2003 computers.
- Scriptomatic 1.0 gave you a bare-bones
environment for running scripts: all you could do was click a button and run
the script in a command window, displaying the returned data on screen. You can
still do that with Scriptomatic 2.0; however, when running the script you also
have options for saving returned data as a text file, saving it as an Excel
file (in comma-delimited format), or saving the returned data as an HTML or XML
file.
- Scriptomatic 1.0 let you write scripts that ran
against only a single computer.
Question: But what if you wanted to run that script
against multiple computers?
Answer: Well, we were getting to that: you couldn’t
run the script against multiple computers, at least not without re-writing the
thing. But that’s not the case with Scriptomatic 2.0. With Scriptomatic 2.0,
you can enter a bunch of computer names (as a comma-separated list, or by
loading the names in from a text file), and the new Scriptomatic will
automatically write you a script that runs against all those machines.
Question: That’s pretty cool.
Answer: We like to think so. After all, could you
write a script like that using Classic Coke?
Well, OK, maybe if you did it that way. But most
people don’t know about that.
Question: So is this multiple computer thing the best
new feature of Scriptomatic 2.0?
Answer: Oh, by far. But by far the best new feature
of Scriptomatic 2.0 is the fact that the Scriptomatic now speaks multiple
languages. With Classic Scriptomatic you could write a script that used any
scripting language you wanted, just as long as the scripting language you
wanted was VBScript. With Scriptomatic 2.0, you can choose to create scripts
written in VBScript, JScript, Perl, or Python.
Question: Really? So if I prefer Perl over VBScript,
I can use Scriptomatic 2.0 to write Perl scripts.
Answer: You bet.
Question: And if I prefer Python over Perl, I can use
Scriptomatic 2.0 to write Python scripts.
Answer: Of course.
Question: And if I prefer --
Answer: Yes.
How to Use Scriptomatic 2.0
Question: Wow. So I guess that with all these new
features Scriptomatic 2.0 must be really hard to use, huh?
Answer:
Question: I said, “I guess that with all these new
features Scriptomatic 2.0 must be really hard to use, huh?”
Answer: Oh, sorry, we thought the press conference
was over. No, the Scriptomatic is as easy to use as it ever was. You have a few
more options available to you, but you can still write a complete,
fully-functional WMI script with just a couple of mouse clicks.
Question: That’s hard to believe. Could you give us a
demonstration?
Answer: We’d love to. To begin with, start
Scriptomatic 2.0 by double-clicking the file ScriptomaticV2.hta. After a few
seconds, your screen should look like this:
By default, Scriptomatic 2.0 loads all the classes found in
the root\cimv2 namespace. If that’s the namespace you want to use, then you’re
ready to write a script.
Question: But what if I want to use a different
namespace?
Answer:
That’s no problem. Just click the little dropdown labeled WMI Namspace.
A list of all the WMI namespaces found on the local computer will appear, like
so:
Pick the namespace you want to use, and Scriptomatic 2.0
will automatically load all the classes found in that namespace into the
dropdown labeled WMI Class.
Question: Then what?
Answer: At this point you’re practically done. Just
select a class from the WMI Class dropdown, and in a split-second the
Scriptomatic will write a script for you that returns information for all the
properties of that class. For example, suppose you want information about the
Win32_BIOS class. Just select that class from the dropdown and you’ll get
something like this:
Give it a try using Win32_BIOS. You’ll not only get a
script, you’ll also see how Scriptomatic 2.0 handles arrays and how it converts
dates and times from UTC format to something a bit more readable.
Question: Cool. But it looks like this script is
written in VBScript. How do I get a script written in Perl or one of those
other scripting languages?
Answer: Well, you’re right: VBScript is the default
language for the Scriptomatic 2.0. But it’s not exactly hard to write a script
using one of the other languages. For example, you want a Perl script? Then
just click the radio button labeled Perl:
Question: Oh, I see. So how do I make Perl the
default language for Scriptomatic 2.0?
Answer: Uh, next question, please.
Question: So I can’t make Perl the default
language?
Answer: Well, no, sorry. But after you select Perl,
any subsequent scripts you write in this session will be written in
Perl, at least until you select a different language option. So that’s good.
Question: So you’re telling me it’s absolutely impossible
to make Perl the default language?
Answer: Boy, you just don’t give up, do you? OK, if
you really want Perl to be the default language, you can follow these steps.
Question: Is this guaranteed to work?
Answer: Well, it’s guaranteed just as strongly as the
rest of the Scriptomatic, which is to say there’s no guarantee at all. But it should
work, and as long as you make changes on a copy of Scriptomatic 2.0, you
should be fine. If it doesn’t work, then you just throw the copy away and go
back to the unedited version of Scriptomatic 2.0.
Anyway, do this:
- Make a copy of ScriptomaticV2.hta, and open that
copy in Notepad.
- Scroll down until you find these lines of code:
'************************
'* Global State Variables
'************************
g_strCurrentLanguage = "VBScript"
g_strCurrentNamespace = "\root\CIMV2"
g_strOutputFormat = "CmdLine"
- Change the value of the variable
g_strCurrentLanguage to Perl (or to Python or JScript, as desired):
g_strCurrentLanguage = "Perl"
- Scroll down to the end of the file and look for
these lines of code:
<tr>
<td><span style="font-size:8pt;">VBScript</span></td>
<td><input type="radio" name="language" onClick="ComposeVBScriptCode" CHECKED></td>
<tr>
<tr>
<td><span style="font-size:8pt;">Perl </span></td>
<td><input type="radio" name="language" onClick="ComposePerlCode"></td>
</tr>
<tr>
<td><span style="font-size:8pt;">JScript </span></td>
<td><input type="radio" name="language" onClick="ComposeJScriptCode"></td>
</tr>
<tr>
<td><span style="font-size:8pt;">Python </span></td>
<td><input type="radio" name="language" onClick="ComposePythonCode"></td>
</tr>
- Remove the parameter found after
onClick=”ComposeVBScriptCode”. Type after
onClick=”ComposePerlCode” (or ComposePythonCode or JScriptCode, depending on
the default you want to use). Your code should now look like this:
<tr>
<td><span style="font-size:8pt;">VBScript</span></td>
<td><input type="radio" name="language" onClick="ComposeVBScriptCode" ></td>
<tr>
<tr>
<td><span style="font-size:8pt;">Perl </span></td>
<td><input type="radio" name="language" onClick="ComposePerlCode" CHECKED></td>
</tr>
<tr>
<td><span style="font-size:8pt;">JScript </span></td>
<td><input type="radio" name="language" onClick="ComposeJScriptCode"></td>
</tr>
<tr>
<td><span style="font-size:8pt;">Python </span></td>
<td><input type="radio" name="language" onClick="ComposePythonCode"></td>
</tr>
- Save the file and –with any luck – Perl will now
be set as your default scripting language.
Question: OK, that’s not too bad. Now what
about all those buttons under the label Output Format? I’ve clicked all
of them, but nothing seems to happen.
Answer: There’s a good reason for that: when you
click them, nothing does happen. Those buttons don’t affect the actual
script written by the Scriptomatic; they come into play only if you click the Run
button and then run the script from within Scriptomatic 2.0.
Question: I don’t get it.
Answer: OK, then do this. Write a script – using any
class or language you want – and then click the Run button. A command
window should pop up on screen, the script you just wrote should run, and the
results should appear in that command window. The whole thing ought to look
something like this:
That’s with the Output Format set to the default (Command
Prompt). Now, select a different option, say, HTML. Your screen
should look like this:
Run the script again, and see what happens. This time, your
output should appear in a Web page rather than the command window:
With the Plain Text option, output should pop up as a
plain-text file in Notepad; with Excel, the output should pop up in
Excel (assuming, of course, that you have Excel installed). And with XML
– well, you get the idea.
By the way, if you want to save this data, make sure you
save it before you run another script. Because Scriptomatic uses the same temp
files over and over, if you run Script A and then run Script B, the results of
Script B will overwrite the old data currently displayed. For example, whatever
happens to be on the HTML page right now will be replaced with a new set of
data.
Question: Let me make sure I understand this now: all
this works only if I run the script from within the Scriptomatic? If I save the
script as, say, a .vbs file and then run it, will it save the output to Excel
or HTML?
Answer: No, sorry. We considered that, but that
brought up far too many complications to handle in a simple HTA. We wanted to
maintain the traditional simplicity of the Scriptomatic as much as we could so
….
Question: Speaking of saving files ….
Answer: Yes, you can save scripts from within the
Scriptomatic. Just click the Save button and then type the path and file
name for the script in this dialog box:
And don’t forget to use the correct file extension: .vbs
for VBScript; .js for JScript; .py for Python; and .pl for
Perl.
Question: So what about this multiple computer stuff?
How does that work?
Answer: Quite well, actually. At the bottom of the
screen you’ll see a text box labeled Target Computers. Just type in the
names of all the computers you want the script to run against, separating the
computer names by commas:
In other words:
atl-ws-01, atl-ws-02, atl-ws-03, atl-ws-04
Note. You know how an entire industry has sprung up
around telling you the inside secrets to video games? Well, here’s an inside
secret to Scriptomatic 2.0: you don’t really have to separate computer
names by commas. Instead, you can separate computer names by blank spaces, by
semi-colons, or even by putting each computer on a separate line, like so:
atl-ws-01
atl-ws-02
atl-ws-03
atl-ws-04
Question: But I don’t like the idea of typing a bunch
of computer names in a text box.
Answer: You big baby!
Um, sorry. What we meant to say is this: “That’s OK.
If you have computer names stored in a text file, you can simply import all
those names by clicking the Load From File button and then picking a
text file to load in.”
Incidentally, regardless of how you get computer names into
the text box, you’ll need to click the Upgrade Script button to get
those names embedded into your script. For better or worse (OK, for worse),
this doesn’t happen automatically.
Question: Don’t get me wrong, I really liked the old
Scriptomatic. But one thing that bothered me is that it could only list the WMI
namespaces and classes that were on my local machine; it couldn’t go out to,
say, one of my servers and get the WMI namespaces and classes found there. I
suppose that’s still a problem with the new version of the Scriptomatic?
Answer: Au contraire, which means – well, we’re not
totally sure what that means. So let’s say this instead: on the contrary. In
Scriptomatic 2.0 you can retrieve WMI information from a remote
computer. Just click the WMI Source button and wait for this dialog box
to appear:
When it does, type in the name of the remote computer, click
OK, and the Scriptomatic will now retrieve information from that remote
machine.
Question: Amazing. Now what do I do when I want to
quit?
Answer: Interesting question; it never occurred to us
that anyone ever would want to quit. But probably the best way to quit
is to simply click the Quit button. You can also quit just by closing
the Scriptomatic 2.0 window, but if you do that the temporary files created by
Scriptomatic won’t be deleted. That’s not a big deal; there are only a handful
of files and they’re pretty small. But, still ….
Support (or Lack Thereof)
Question: Well, I’m sold. But what if I encounter any
problems with Scriptomatic 2.0, what should I do then?
Answer: Send email to scripter@microsoft.com (in English, if
possible). Officially we offer no support for Scriptomatic 2.0 and we can’t
promise to respond to your questions. But we’ll see what we can do.
Future Plans
Question: One last question: will there be a
Scriptomatic 3.0?
Answer: No. We’ve decided to invest all our time and
money in creating a new online venture: scriptBay. It will be a Web site where
we’ll auction WMI scripts off to the highest bidder.
Question: Um, shouldn’t you have done that before
you released Scriptomatic 2.0, which will let people write those same WMI
scripts for free?
Answer: We’ll get back to you on a date for
Scriptomatic 3.0 ….