Hi,
I am unable to get Datastore name in the output for below script
Please help
Get-Cluster -PipelineVariable cluster |
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$myesxcli = Get-EsxCli -VMHost $esx -V2
$myesxcli.storage.core.device.list.Invoke()
$dev = $_
$ds = (Get-Datastore -RelatedObject $esx) | where{$_.ExtensionData.Info.Vmfs.Extent.diskname -contains $dev.Device}
} | Select @{N="Cluster";E={($Cluster).Name}}, @{N="VMHost";E={$esx.Name}}, Device, @{N="Datastore";E={($ds).Name}}, @{N="SizeGB";E={[math]::round($_.Size/1024)}}, IsPerenniallyReserved, DeviceMaxQueueDepth, NoofoutstandingIOswithcompetingworlds | ft -auto
You have to loop per device.
Try like this
Get-Cluster -PipelineVariable cluster |
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$myesxcli = Get-EsxCli -VMHost $esx -V2
$myesxcli.storage.core.device.list.Invoke() |
ForEach-Object -Process {
$dev = $_
$ds = (Get-Datastore -RelatedObject $esx) | where{$_.ExtensionData.Info.Vmfs.Extent.diskname -contains $dev.Device}
$dev | Select @{N="Cluster";E={($Cluster).Name}},
@{N="VMHost";E={$esx.Name}}, Device,
@{N="Datastore";E={($ds).Name}},
@{N="SizeGB";E={[math]::round($_.Size/1024)}},
IsPerenniallyReserved, DeviceMaxQueueDepth, NoofoutstandingIOswithcompetingworlds
}
} | Format-Table -AutoSize
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You have to loop per device.
Try like this
Get-Cluster -PipelineVariable cluster |
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$myesxcli = Get-EsxCli -VMHost $esx -V2
$myesxcli.storage.core.device.list.Invoke() |
ForEach-Object -Process {
$dev = $_
$ds = (Get-Datastore -RelatedObject $esx) | where{$_.ExtensionData.Info.Vmfs.Extent.diskname -contains $dev.Device}
$dev | Select @{N="Cluster";E={($Cluster).Name}},
@{N="VMHost";E={$esx.Name}}, Device,
@{N="Datastore";E={($ds).Name}},
@{N="SizeGB";E={[math]::round($_.Size/1024)}},
IsPerenniallyReserved, DeviceMaxQueueDepth, NoofoutstandingIOswithcompetingworlds
}
} | Format-Table -AutoSize
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you... Perfect as always 🙂