A Portable Scripting Toolbox - What's the object here?
(Page 3 of 5 )
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.
Next: Put your library in your pocket >>
More Windows Scripting Articles
More By Nilpo