never-displayed
View discussion in a popup
I suspect it might be an issue with the Get-VIObjectByVIView cmdlet.
Do you also get the error when you replace line 12 by
$ghd = Get-HardDisk -VM $VM
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference