Strange, that is exactly the same as I have.
And what happens when we leave out the pipelinevariable?
Get-VM | Get-HardDisk |
Select @{N='VM';E={$_.Parent.Name}},
Name,
@{N='SCSIid';E={
$hd = $_
$ctrl = $hd.Parent.Extensiondata.Config.Hardware.Device | where{$_.Key -eq $hd.ExtensionData.ControllerKey}
"$($ctrl.BusNumber):$($_.ExtensionData.UnitNumber)"
}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference