![]() |
The following steps describe how to retrieve information on media devices.
1. Find the instance of CIM_ComputerSystem representing the managed host, as described in Discovering CIM_ComputerSystem.
2. From the CIM_ComputerSystem instance, traverse the CIM_SystemDevice association class to find the instances of CIM_MediaAccessDevice and examine each object:
3. For each object examine:
a. CIM_MediaAccessDevice.Capabilities to see the capabilities of this Device.
b. CIM_MediaAccessDevice.MaxMediaSize to see the maximum size, in KBytes, of media supported by this Device.
Click here for a snippet demonstrating this step
You can execute this snippet by inserting it into the execution template found here.
# Create reference to the CIM_ComputerSystem instance.
$computerSystemRef =$wsmanConnectionObject.NewReference("SELECT * FROM CIM_ComputerSystem WHERE Name='ManagedSystem'")
$systemDeviceRef =$wsmanConnectionObject.NewReference("CIM_SystemDevice")
$systemDeviceRef.AddSelector("GroupComponent",$computerSystemRef)
# Traverse to the CIM_SystemDevice instances that are connected to the CIM_ComputerSystem instance.
foreach($systemDeviceItem in$systemDeviceRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))
{
# For each instance, check if it is associated to the CIM_MediaAccessDevice instance.
if($systemDeviceItem.Object.GetProperty("PartComponent").IsA("CIM_MediaAccessDevice"))
{
# Get the CIM_MediaAccessDevice object using its EPR.
$mediaAccessDeviceInstance =$systemDeviceItem.Object.GetProperty("PartComponent").Ref.Get()
$capabilities =$mediaAccessDeviceInstance.GetProperty("Capabilities")
$maxMediaSize =$mediaAccessDeviceInstance.GetProperty("MaxMediaSize")
}
}
4. From each CIM_MediaAccessDevice, traverse theCIM_Realizes association class to find the instance of CIM_PhysicalPackage.
5. For each object examine:
a. CIM_PhysicalPackage.Model to see the name by which the Physical Element is generally known.
b. CIM_PhysicalPackage.SerialNumber to see the manufacturer-allocated number used to identify the Physical Element.
Click here for a snippet demonstrating this step
You can execute this snippet by inserting it into the execution template found here.
# Create reference to CIM_ComputerSystem instance.
$computerSystemRef =$wsmanConnectionObject.NewReference("SELECT * FROM CIM_ComputerSystem Where Name='ManagedSystem'")
$systemDeviceRef =$wsmanConnectionObject.NewReference("CIM_SystemDevice")
$systemDeviceRef.AddSelector("GroupComponent",$computerSystemRef)
# Traverse to the CIM_SystemDevice instances that are connected to the CIM_ComputerSystem instance.
foreach($systemDeviceItem in$systemDeviceRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))
{
# For each instance, check if it is associated to the CIM_MediaAccessDevice instance.
if($systemDeviceItem.Object.GetProperty("PartComponent").IsA("CIM_MediaAccessDevice"))
{
# Create reference to CIM_MediaAccessDevice instance.
$mediaAccessDeviceRef =$systemDeviceItem.Object.GetProperty("PartComponent").Ref
$realizesRef =$wsmanConnectionObject.NewReference("CIM_Realizes")
$realizesRef.AddSelector("Dependent",$mediaAccessDeviceRef)
# Traverse to the CIM_Realizes instances that are connected to the CIM_MediaAccessDevice instance.
foreach($realizesItem in$realizesRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))
{
# For each instance, check if it is associated to the CIM_PhysicalPackage instance.
if($realizesItem.Object.GetProperty("Antecedent").IsA("CIM_PhysicalPackage"))
{
# Get the CIM_PhysicalPackage object using its EPR.
$physicalPackageInstance =$realizesItem.Object.GetProperty("Antecedent").Ref.Get()
$model =$physicalPackageInstance.GetProperty("Model")
$serialNumber =$physicalPackageInstance.GetProperty("SerialNumber")
}
}
}
}
Instance Diagram
Classes Used in This Flow
SDK Sample
If there is a sample demonstrating this flow, it is included in the SDK installation file. See SDK Installation Layout for details.
Copyright © 2006-2022, Intel Corporation. All rights reserved. |