Searching for cdrom devices with Emulate Ide or Passthrough IDE mode in powercli

by Grzegorz Kulikowski

Right,
so we want to find all vms that have their cdrom device set to Emulate Ide mode.
[sourcecode language=”powershell”]
$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
if ($vm.Config.Hardware.Device |? {$_.backing -is [vmware.vim.VirtualCdromRemoteAtapiBackingInfo]}) {$vm.name}
}
[/sourcecode]
If we want to look for vms with cdrom devices mode set to Passthrough:
[sourcecode language=”powershell”]
$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
if ($vm.Config.Hardware.Device |? {$_.backing -is [vmware.vim.VirtualCdromRemotePassthroughBackingInfo]}) {$vm.name}
}
[/sourcecode]

No fancy output 😉 Just sending to screen affected vm names.

Advertisements

You may also like

Leave a Reply

Chinese (Simplified)DutchEnglishFrenchGermanHindiPolishRussianSpanish