每个 CIM 类都有一个静态 getInstances() 方法,该方法返回类对象的数组。
要检索受 CA Server Automation 管理的所有系统,请使用以下命令:
aObjs = CA_ComputerSystem.getInstances() ? "Query returned", oObjs.length
要检索受 CA Server Automation 管理的部分系统,请使用以下筛选表达式之一:
aObjs = CA_ComputerSystem.getInstances("ElementName=’Everest.local'")
或
aObjs = CA_ComputerSystem.getInstances("ElementName like 'Ev*'")
要检索系统名称和说明,请使用以下命令:
aObjs = CA_ComputerSystem.getInstances(); for(i=0; i<aObjs.length; i++) ? aObjs[i].getElementName(),aObjs[i].getDescription()
要检索 CIM 对象属性和值,请使用以下命令:
aObjs = CA_ComputerSystem.getInstances("ElementName='Debian1'") show-cimObject aObjs[0]
示例:show-cimObject 命令的输出
CA_ComputerSystem ================= Caption: null Description: null ElementName: Debian1 Facets: 44 InstallDate: null Name: 47332da1-e782-0308-d614-c2e99de989bc OperationalStatus: undefined StatusDescriptions: undefined Status: null HealthState: 5 PropagatedHealthState: null IsPropagated: true PrimaryStatus: null DetailedStatus: null OperatingStatus: null CommunicationStatus: null ManagementStatus: null EnabledState: null OtherEnabledState: null RequestedState: null EnabledDefault: null TimeOfLastStateChange: null AvailableRequestedStates: undefined TransitioningToState: null CreationClassName: CA_ComputerSystem NameFormat: null PrimaryOwnerName: null PrimaryOwnerContact: null Roles: undefined OtherIdentifyingInfo: undefined IdentifyingDescriptions: undefined Dedicated: undefined OtherDedicatedDescriptions: undefined ResetCapability: null PowerManagementCapabilities: undefined HostName: 192.168.1.119 IpAddress: null SerialNumber: null Version: null CpuCount: 1 TotalVisibleMemorySize: 256 PatchLevel: null BiosVersion: null Fans: null Chassis: null DrCapable: null VendorId: null MacAddress: null ArchTypeUID: null Available: null LastUpdate: null SnapshotType: null TotalStorageCapacity: null Model: null CpuSpeed: null SystemImageId: null HardwareClassId: null
版权所有 © 2013 CA。
保留所有权利。
|
|