Using Sample Scripts

You can run the sample scripts as is. You can also use the scripts as the starting point for writing your own Perl scripts to obtain CIM data from the server.
If you accepted the defaults during vSphere SDK for Perl installation, the samples are in the following location on a Windows system.
C:\Program Files\VMware\VMware VI CLI\Perl\samples\WSMan
When you run the samples, you must specify connection options. See vSphere SDK for Perl Common Options. For example, you can specify connection options on the command line as follows.
perl <scriptname.pl> --server <servername> --username <username> --password <password>
For example:
perl firmwarerevisions.pl --server my.FQDN.esx35server.com --username root --password root_pass
If
--server
is not specified, it defaults to
localhost
. If you are connecting to a remote host and do not specify a user name and password, you are prompted.
The CIMOM service listens for requests on port 80.
WSMan Sample Scripts
Script
Description
checksensorhealth.pl
Returns a list of sensors associated with all system devices.
firmwarerevisions.pl
Obtains a list of firmware revisions on the system.
listfrus.pl
Returns a list of all field-replaceable units on the system.
listpowersupplies.pl
Obtains status of discrete sensors associated with all power supplies. Demonstrates traversing associations and using
GetInstance
.
The WS-Management library consists of the
WSMan::Basic
and
WSMan::GenericOps
classes, and the
StubOps.pm
object-oriented wrapper for generic operations. The following sections discuss each library component.