[Cialug] Windows Scripting

Todd Walton tdwalton at gmail.com
Tue Jan 30 12:29:49 CST 2007


I'm looking at a couple of Microsoft Press books on Windows scripting.
 From the introductions of each:

"This is a book about scripting for system administrators.  If you are
like many system administrators, you might be wondering why this book
is targeted towards you.  After all, scripting is not the sort of
thing system administrators do.  Everyone knows about scripting:
scripting is hard; scripting is time-consuming; scripting requires you
to learn all sorts of technical jargon and master a whole host of
acronyms -- WSH, WMI, ADSI, CDO, ADO, COM.  System administrators have
neither the time nor the requisite background to become script
writers."

-- _Microsoft Windows 2000 Scripting Guide: Automating System Administration_

"Personally, I'm delighted that Windows is now such a mature, stable
product that we have the time and tools to explore automation through
scripting.  I'm also glad that more administrators are tackling
advanced topics, which tells me that Windows has truly become an
enterprise operating system, with the level of complexity and
scriptability often associated with traditional enterprise-class
operating systems such as UNIX."

-- _Advanced VBScript for Microsoft Windows Administrators_

To be fair, scripting *is* hard on Windows, and *does* require
technical jargon and acronyms out the ears.  As for the advanced
book's intro, the claim that Windows has reached the level of
scriptability of UNIX is so far from the truth that I have to wonder
if the author is running for political office.  Even if you ruled out
the GUI (and thus unscriptable) third party apps that the Windows
environment encourages... Even if you count only the core operating
system... Windows is still nowhere near as scriptable as a UNIX system
such as Linux, where every facet of the operating environment is
talkative via pipes and shell I/O redirection and exposed via the
/proc filesystem.  It's a little difficult to pipe the Windows
registry through a text filter!  And regular expressions?  Forget it.
There's not a single mention of regexes that I can find in the
advanced book, and it's not in the index.

It makes me wonder who these people are that write these books.

To be fair I'll mention two things I like about Windows scripting that
I haven't yet found on Linux.  Both are file formats:

1) Windows Script File, .wsf

It's a script (anything that the Windows Script Host will support,
which is VBScript, JScript, Perl, etc.) wrapped in an XML file.  The
XML file holds things like usage instructions, examples, allowed
arguments, and so on.  So you only have to write the script and list
the above, and the Windows shell will handle basic stuff like spitting
out an error if you use the script the wrong way.  WSFs aren't the
answer to every problem, but they're handy for what they're worth.
Linux has a handful of tools in this direction.  Perl has some built
in stuff, and there's that bash argument handler thing that I can't
remember the name of.

2) HTML Application, .hta

This is da bomb.  HTA files are scripts wrapped in HTML.  They're made
to run locally, though you can serve them through a site as a file of
course.  Because they run locally they have local permissions and can
move files around and the like.  What you get, in effect, is a script
with a graphical user interface.  You have buttons and drop down menus
and list boxes and self-rewriting HTML and all the other wonderful
goodies that HTML provides.  This is way cool, and I'm not sure how
I'd do the equivalent on Linux, without actually running a web server.

-todd


More information about the Cialug mailing list