I have a script that collects storage inventory data and it works fine as long as all the esx hosts are in a connected state, but if one of the hosts is disconnected (down for maintenance or something like that), then the get-ScsiLun commandlet hangs. The problem code looks like this:
$datastore=get-datastore "datastore name"
$luns =Get-ScsiLun -datastore $datastore
If any of the hosts attached to the datastore is down, then the Get-ScsiLun command will hang indefinitely.
Which PowerCLI version is that (do a Get-PowerCLIVersion)?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I've tried both:
VMware vSphere PowerCLI 6.3 Release 1 build 3737840
and:
VMware vSphere PowerCLI 5.1 Release 1 build 793510
Hm, I don't seem to get that effect.
I'm using 6.5R1, any chance you could try that one?
Does this bypass correctly the disconnected ESXi nodes correctly?
Get-Cluster -Name MyCluster | Get-VMHost |
where{$_.ConnectionState -eq 'Connected'} | %{
Get-Datastore -Name MyDatatstore -RelatedObject $_ |
Get-ScsiLun
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference