VMware Cloud Community
qwert1235
Enthusiast
Enthusiast

Find hosts with specific CD-Rom

Hello:

What is the best way to find (list) all ESX hosts in the VC that have CD-Rom with specific characteristics (vendor, model, revis)?

Thank you,

qwert

Reply
0 Kudos
4 Replies
aevrov
VMware Employee
VMware Employee

Hi qwert1235,

Here's how you can get an ESX host's cdroms:

# Get the host
$h = Get-VMHost | select -First 1

# Get its storage system
$ssView = Get-View -Id $h.ExtensionData.ConfigManager.StorageSystem

# Get the scsi luns and filter the cdroms
$ssView.StorageDeviceInfo.ScsiLun | where { $_.DeviceType -eq "cdrom" }

# Result:

Key              : key-vim.host.ScsiLun-0005000000766d68626133323a303a30
Uuid             : 0005000000766d68626133323a303a30
Descriptor       : {mpx.vmhba32:C0:T0:L0, vml.0005000000766d68626133323a303a30, 0005000000766d68626133323a303a30}
CanonicalName    : mpx.vmhba32:C0:T0:L0
DisplayName      : Local NECVMWar CD-ROM (mpx.vmhba32:C0:T0:L0)
LunType          : cdrom
Vendor           : NECVMWar
Model            : VMware IDE CDR10
Revision         : 1.00
ScsiLevel        : 5
SerialNumber     : unavailable
DurableName      :
AlternateName    :
StandardInquiry  : {5, -128, 5, 50...}
QueueDepth       :
OperationalState : {ok}
Capabilities     : VMware.Vim.ScsiLunCapabilities
VStorageSupport  : vStorageUnknown
DeviceName       : /vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0
DeviceType       : cdrom
DynamicType      :
DynamicProperty  :

- Angel

qwert1235
Enthusiast
Enthusiast

Great!  Thanks a lot!

Now I just have to work on filtering by specific vendor

Reply
0 Kudos
LucD
Leadership
Leadership

Try chancing this line

$ssView.StorageDeviceInfo.ScsiLun | where { $_.DeviceType -eq "cdrom" }

into something like this

$ssView.StorageDeviceInfo.ScsiLun | where { $_.DeviceType -eq "cdrom" -and $_.Vendor -like "NEC*"}

That will get you all CDROMs where the vendor starts with NEC


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

qwert1235
Enthusiast
Enthusiast

Thank you, Luc (sorry did not came back earlier).

I''ll let you know how it will go.

Thanks again!

Reply
0 Kudos