Traverse the
CIM_ElementConformsToProfile association to reach the Scoping
Instance.
function associate_to_scoping_instance( connection, profile_name )
///Follow ElementConformsToProfile from RegisteredProfile to ComputerSystem.///
instance_names = connection.AssociatorNames( profile_name, \
AssocClass = 'CIM_ElementConformsToProfile', \
ResultRole = 'ManagedElement' )
if len( instance_names ) > 1
print 'Error: %d Scoping Instances found.' % len( instance_names )
sys.exit(-1)
return instance_names.pop()
function print_instance( instance )
print '\n' + ' [' + instance.classname + '] ='
for prop in instance.keys()
print ' %30s = %s' % ( prop, instance[prop] )
scoping_instance_name = associate_to_scoping_instance( connection, profile_instance_name )
if scoping_instance_name is Null
print 'Failed to find Scoping Instance.'
sys.exit(-1)
else
print_instance( connection.GetInstance( scoping_instance_name )
|