Translating into Perl

Although Microsoft’s evident support for VBScript and JScript mean that Perl might not be quite as prevalent in the world of Windows 2000 as it was under NT 4.0, the language remains a powerful scripting tool, and it certainly deserves a mention here! If you are a Perl aficionado, you will be delighted to hear that the language allows you to access COM objects through the Win32::OLE module that ships as standard with ActiveState’s Perl distributions. This module provides a GetObject() function, the equivalent of a CreateObject(), elegant collection handling, and even support for event handling. A translation of our original VBScript, the service-listing script, looks something like this:

 #services.pl - list services and ...

Get Windows Management Instrumentation (WMI) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.