A Portable Scripting Toolbox

Windows scripting is like anything else. Having the right tool for the job makes life a whole lot easier. There are a plethora of coding environments and IDEs that have been built for Windows scripting. Unfortunately, quite often scripts need to be written on location, without the help of these friendly applications.

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
August 27, 2008
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Thankfully, you're not out of luck.  There are a number of stand-alone applications that can make your life easier and provide you with more than Notepad when you're away from your development machine.  Here's some of the ones that I recommend and think that no scripter should do without.

I've taken special care to choose tools that I know work, and don't require installation.  Since these tools are portable, you can throw them on a USB drive and literally carry everything you need to write any script right in your pocket.  You may find some of these tools so useful that you'll keep them on your development machine as well.

As I see it, a scripter has three basic areas of need.  The first of these is a decent editor.  While Windows scripts are nothing more than plain text files, you don't want to resort to using Notepad if you really don't have to.  Good editors geared toward Windows scripters are very hard to find, but I've got a suggestion for you that you'll probably find very useful.

The second need as I see it is being able to find the objects that you need and to be able to see their methods and properties.  Without auto-complete, and possibly without Internet access, writing scripts can become extremely frustrating without a little help.  This is where object browsers come into play.  They have the ability to examine the registry and local type libraries and expose information about the objects that are installed on the current system.  This applies for WMI as well.

The third need that I see is good documentation.  Simply finding objects and methods is not always enough.  Having a good error code reference and documentation of common objects can save loads of debugging time.  While most people won't be able to carry the MSDN Library with them, there are several reference sources that can prove invaluable.  Along with documentation, I'll also show you several sample code libraries that you can take with you on the go as well.

I've also decided to include one last group of tools for scripters.  While this doesn't address a specific need, it can certainly increase productivity.  These are portable code generators.  You provide a few simple details about a task you wish to perform, and these guys can spit out relevant code for you-saving lots of development time.

Every script author needs a good editor!

There are quite literally dozens upon dozens of freeware text editors available.  Some are geared toward traditional writers, some toward programmers, and even a few specifically toward scripters.  Most offer the same basic feature set.

For a scripter, the most important of these features is probably syntax highlight.  Syntax highlight can aid greatly when constructing code.  It color codes different coding elements and allows you to see many mistakes at a glance.  This can aid greatly when the need arises to debug code.

Features such as auto-completion and code insertion are also extremely valuable, sought after features that were once reserved only for full-scale applications, but that's not the case anymore.  Enter Kudaz.

Kudaz

Kudaz is a one-of-a-kind program that goes far beyond a common text editor.  It's unlike any other similar application that I've ever seen.

In addition to syntax highlighting, Kudaz offers many features thought to be non-existent in a stand-alone text editor such as auto-completion, auto-correction, support for code snippets, project management, block indent and outdent support, bookmarks, and much, much more.  The minute you start using this application you'll forget that you're not using a much more advanced program.

The features in Kudaz are highly configurable and customizable.  Settings are stored in local INI files so there's no need to write anything to the registry.  Kudaz also doesn't require any installed dependencies, which makes this editor completely portable.  Just copy the program directory to your flash device and be on your way.

Kudaz has very thorough help documentation and is continually under development.  Support for international languages is still shy at best, but it's probably just a matter of time.  I threw away every other editor I'd ever used within minutes of finding this great application.

What's the object here?

Probably the single hardest challenge any scripter has to face is finding the right objects and methods to perform the task.  There's no easy way to do this and it often requires some time spent searching the Internet or leafing through endless pages of documentation.

Many times you may know the object you need but forget the method or property name.  Or you may even know the name and forget the proper parameters.  This is when object browsers come in handy.  They can examine COM objects and other elements and expose their methods, properties, and events by reading the type library associated with the object.

Typically, they can tell you what objects are available, enumerate their methods and properties, and also document each of the methods and properties to tell you what data types are involved.  Manually examining these objects is the only way to find the information you need when the original documentation is not available.

For examining most objects I rely almost solely on Mark Pryor's TLViewer.

TLViewer

TLViewer is a lightweight, stand alone object viewer written in VB6 that was designed with scripting in mind.  It only exposes those interfaces that are available to scripters so there's no need to wade through a bunch of senseless information that's utterly and completely useless to you.

One major advantage of TLViewer is that you can find objects by searching by ProgID, ProgID help string, or by Type Library help string.  This is a major plus.  Most object browsers that I've come across do not let you find objects based on ProgID-and that's how most scripters know them!

TLViewer's only dependency is TLBINF32.DLL, which can be downloaded from the program's home page.  This does not need to be installed on host systems; you can simply drop it in the program directory and it will run perfectly, making this a great portable object browser.

K-Soft WMI Explorer and Sapien WMI Explorer

A large portion of system administration scripts rely on Windows Management Instrumentation (WMI).  Finding the correct WMI classes and associated methods, properties, and instances can also be a nightmare for scripters without access the MSDN.

K-Soft and Sapien both offer utilities called WMI Explorer.  If you're wondering why I've provided both, it's because I use both.  The basic purpose of these two applications is the same.  Both allow you to browse WMI namespaces and view the properties and their current settings for specific instances.  However, it's where they differ that makes a difference.

  • Scope - Sapien's WMI Explorer will allow you to browse all WMI classes while K-Soft's version only allows the standard CIMV2 namespace. 
  • Methods - Sapien's WMI Explorer will also enumerate the methods associated a class where K-Soft's won't.
  • Queries - K-Soft's WMI Explorer will allow you to test and run queries within the browser.  Sapien's will not.

Overall, the Sapien WMI Explorer is a much more complete tool, but I keep K-Soft's version around for times when I need to experiment with queries.

Windows also provides a built-in tool called Wbemtest that can be used to browse WMI namespaces.  Just type Wbemtest in the Run... dialog box to get started.

PowerShell developers might also want to check out the PowerShell WMI Explorer, a WMI browser designed with PowerShell users in mind.

Put your library in your pocket

Every good scripter loves documentation.  Okay, maybe loves was a bit of an exaggeration, but certainly every scripter needs good documentation from time to time-and there's plenty of good documentation to be had, so why not bring it with you?

Documentation comes in all shapes and sizes, but help files and PDFs are the easiest to carry.  And, as it turns out, most of the references you probably use online are available in one of these formats.  Here's a short list of some of the best that I've come across.

Script56.chm - Windows Script Host 5.6 Documentation

This packaged help file contains the entire Windows Script Host documentation and language references for VBScript and Jscript.  It also includes WSH Object Models.

The Hey, Scripting Guy! Archive

The compiled help file contains every Hey, Scripting Guy! article from August 2004 through September 2007.  Neatly categorized and fully searchable, this is probably one the single best help choices you have.

Script Center All-in-One

This is another compiled help file from the TechNet Script Center.  This one contains over 160 articles including Tales From the Script, Office Space, Scripting Clinic columns, and more.  It's the perfect companion to the Hey, Scripting Guy! archive.

Sesame Script Archive

Go for the hat trick by downloading the third compiled help file available from the Scripting Guys at the TechNet Script Center.  This archives the monthly Sesame Script column.  Don't miss a single article from 2005 through 2007.

PowerShell Graphical Help File

Finally, if you're a PowerShell user, you'll want to download a copy of the PowerShell graphical help file.  This is a compiled help file that documents all of the PowerShell cmdlets.

Don't stop here!  These are just a few of the files I find indispensable and they make a good starting point.  The fact is, that you should take whatever you feel you'll need.  The sky is the limit and you can't be too prepared.  You might even consider purchasing eBook or PDF versions of your favorite books as well.

Don't reinvent the wheel

I'm sure that you've all heard the expression "don't reinvent the wheel."  As it turns out, that's pretty solid advice.  Why waste time figuring out something that's already been figured out before?

Bring on the code!  It's a generally a good idea to have sample code and code snippets available too.  These prewritten pieces of code can save time and energy.  Why write your own tool for the job, if there's already been one written before.  Follow my motto:

"Make yourself look smart; sponge off of someone else's work."

Umm, wait.  I never said that.  I, ahem...  Here's some code sample packs and code generators you might find useful.

Do-It-Yourself Script Center Kit

This is a great resource that contains nearly every script in the Script Center Repository.  You can keep them as snippets, package them in a CHM file, and more.  Put the entire Script Center Repository at your fingers tips wherever and whenever you need it.

Scriptomatic 2.0

The new and improved version of an old classic, Scriptomatic 2.0 is a code generator developed by Microsoft's Scripting Guys as a learning tool to help system administrators learn the ropes about scripting.  Drop a quarter in the slot and let the Scriptomatic push out an admin script that fits your needs.  There's even an ADSI Scriptomatic for creating ADSI scripts and an HTA Scriptomatic for developing HTML Applications.

This list does not even begin to touch on the plethora of resources that are available to you.  My goal in this article was only to point you in the right direction and perhaps give you a head start for creating your own portable scripting toolbox.  So, now no matter where-no matter when-you're always ready.  Until next time, keep coding!

blog comments powered by Disqus
WINDOWS SCRIPTING ARTICLES

- More Windows Scripting Workarounds from Nilpo
- Overloading Methods and More in VBScript
- Improving MFC for Windows Vista
- Regular Expressions in VBScript
- Working with Dates in WMI
- Completing Calendars with VBScript Date Func...
- Building Calendars with VBScript Date Functi...
- Working With Dates and Times in VBScript
- Designing WCF DataContract Classes Using the...
- Understanding Dates and Times in VBScript
- Working With Arrays in VBScript
- Compressed Folders in WSH
- Using .NET Interops in VBScript
- Nilpo`s Scripting Secrets, Vol I
- Database operations using Silverlight 2.0 WC...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials