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

Right,
so we want to find all vms that have their cdrom device set to Emulate Ide mode.

$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
 if ($vm.Config.Hardware.Device |? {$_.backing -is [vmware.vim.VirtualCdromRemoteAtapiBackingInfo]}) {$vm.name}
}

If we want to look for vms with cdrom devices mode set to Passthrough:

$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
 if ($vm.Config.Hardware.Device |? {$_.backing -is [vmware.vim.VirtualCdromRemotePassthroughBackingInfo]}) {$vm.name}
}

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

Advertisements