Ryan_1
Contributor
Contributor

find SCSI controller type of all VMs

Jump to solution

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

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

You could try Hal's solution in


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

0 Kudos
esarakaitis
Enthusiast
Enthusiast

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

that ROCKS!!!

0 Kudos
esarakaitis
Enthusiast
Enthusiast

lot easier to follow than the other script

0 Kudos