VMware Cloud Community
Ryan_1
Contributor
Contributor
Jump to solution

find SCSI controller type of all VMs

Hello Guyz... help pls. how can i find the SCSI controller type of all the VMs in a particular datacenter

0 Kudos
1 Solution

Accepted Solutions
esarakaitis
Enthusiast
Enthusiast
Jump to solution

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}}
}

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

You could try Hal's solution in


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

0 Kudos
esarakaitis
Enthusiast
Enthusiast
Jump to solution

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}}
}

0 Kudos
Ryan_1
Contributor
Contributor
Jump to solution

that ROCKS!!!

0 Kudos
esarakaitis
Enthusiast
Enthusiast
Jump to solution

lot easier to follow than the other script

0 Kudos