Hello Guyz... help pls. how can i find the SCSI controller type of all the VMs in a particular datacenter
try this!
# Get the VMs $vm = get-datacenter "DATACENTER" | get-vm # For each of the VMs $vm | % { $vmview = get-view $_.id # Get all of the SCSI controller devices $hardware = $vmview.config.hardware $devices = $hardware | % {$_.device} $deviceinfo = $devices | % {$_.deviceinfo} $controller = $deviceinfo | ? {$_.label -like "SCSI Contro*"} $controller | select-object @{name="Name"; expression={$vmview.name}}, @{name="Controller"; expression={$_.label}}, @{name="Controller Type"; expression={$_.summary}} }
You could try Hal's solution in
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
try this!
# Get the VMs $vm = get-datacenter "DATACENTER" | get-vm # For each of the VMs $vm | % { $vmview = get-view $_.id # Get all of the SCSI controller devices $hardware = $vmview.config.hardware $devices = $hardware | % {$_.device} $deviceinfo = $devices | % {$_.deviceinfo} $controller = $deviceinfo | ? {$_.label -like "SCSI Contro*"} $controller | select-object @{name="Name"; expression={$vmview.name}}, @{name="Controller"; expression={$_.label}}, @{name="Controller Type"; expression={$_.summary}} }
that ROCKS!!!
lot easier to follow than the other script