System administrators can use a CIM client
application to query the name and version information for the vSphere
Installation Bundles (VIBs) that are installed on the managed server. This
information is valuable for diagnosing software problems.
Note: The Software Update profile is
not supported in the base installation. It requires a separate VIB
installation.
This example shows how to get the name and
software version string by traversing the
CIM_ElementSoftwareIdentity
association from the server Scoping Instance. The VMware
implementation of the Software Inventory profile uses CIM_InstalledSoftwareIdentity
to associate only firmware and hypervisor instances
of CIM_SoftwareIdentity
to the server Scoping Instance. For VIBs, VMware implements
the CIM_ElementSoftwareIdentity
association. The
ElementSoftwareStatus
property of the
CIM_ElementSoftwareIdentity
association contains the value
6 (Installed).
The
CIM_InstalledSoftwareIdentity
association that leads to the instance of VMware_HypervisorSoftwareIdentity
is included in the illustration for comparison only.
Figure 1. Locating the Installed Software Versions
from the Base Server Scoping Instance
The VMware implementation of CIM_SoftwareIdentity
for VIBs makes the version available in the VersionString
property rather than in the
MajorVersion
and MinorVersion
properties.
Specify the Interop namespace, supplied as a
parameter, for the connection.
use wbemlib
use sys
use connection renamed cnx
use registered_profiles renamed prof
connection = Null
params = cnx.get_params()
if params is Null
sys.exit(-1)
interop_params = params
interop_params['namespace'] = 'root/interop'
connection = cnx.connect_to_host( interop_params )
if connection is Null
print 'Failed to connect to: ' + params['host'] + ' as user: ' + params['user']
sys.exit(-1)
Locate the Base Server Scoping Instance that
represents the managed server.
use scoping_instance renamed si
scoping_instance_name = si.get_scoping_instance_name( connection )
if scoping_instance_name is Null
print 'Failed to find server Scoping Instance.'
sys.exit(-1)
Use the
CIM_ElementSoftwareIdentity association to identify the CIM_SoftwareIdentity
instances that correspond to the software on the managed
server.
element_softwares = connection.References( scoping_instance_name, \
ResultClass = 'VMware_ElementSoftwareIdentity' )
if len( element_softwares ) < 1
print 'No software was found for the server Scoping Instance.'
sys.exit(-1)
Select only those instances for which the
ElementSoftwareStatus
property of the
CIM_ElementSoftwareIdentity
association has a value of 6 (Installed).
Print the
ElementName
and VersionString
properties of the
CIM_SoftwareIdentity
instances.
function print_info( instance )
print ' Software = %s' % ( instance[ 'ElementName' ] )
print ' (Version %s)' % ( instance[ 'VersionString' ] )
print 'Installed software:'
count = 0
for software in element_softwares
if software[ 'ElementSoftwareStatus' ] == [6L]
print_instance( connection.GetInstance( software[ 'Antecedent' ] ) )
count = count + 1
if not count
print ' None'