Hi , Could anyone help in getting total storage capacity and used storage capacity via powercli script. It is showing in below screen shot highlighted in yellow.
Try something like this
$report = Get-VMHost -Name MyEsx -PipelineVariable esx | Get-Datastore |
Select @{N='VMHost';E={$esx.Name}},Name,FreeSpaceMB,CapacityMB
$report += '' | Select @{N='VMHost';E={'Total'}},@{N='Name';E={''}},
@{N='FreeSpaceMB';E={($report | Measure-Object -Property FreeSpaceMb -Sum).Sum}},
@{N='CapacityMB';E={($report | Measure-Object -Property CapacityMB -Sum).Sum}}
$report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you actually search this community?
That same question has been posted before.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I searched but didn't find anything helping.
This was on the search results for "storage capacity": https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Storage-usage-for-a-particular-data-st...
Thanks but this does fulfil my requirement, but I searched more and found this below, this is actually nearby my requirement but can we put a filter of a single esxi host and get all connected storage capacity, used and free details.
You could do something like this
Get-VMHost -Name MyESx -PipelineVariable esx | Get-Datastore |
Select @{N='VMHost';E={$esx.Name}},Name,FreeSpaceMB,CapacityMB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD, You almost brought me at solution. Can you help me out also to get subtotal of all FreeSpaceGB and CapacityGB in this script
Get-VMHost -Name myesx01 -PipelineVariable esx01 | Get-Datastore |
Select @{N='VMHost';E={$esx01.Name}},Name,
FreeSpaceGB,
CapacityGB
What do you mean by subtotal?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Means, It shows many datastores connected to a esx and their sizes, I want a total also of that many datastores FreeSpaceGB and CapacityGB something like below if possible
FreeSpaceGB | CapacityGB | |
152 | 566 | |
41 | 111 | |
52 | 150 | |
62 | 200 | |
542 | 3000 | |
52 | 510 | |
25 | 50 | |
Total | 926 | 4587 |
Try something like this
$report = Get-VMHost -Name MyEsx -PipelineVariable esx | Get-Datastore |
Select @{N='VMHost';E={$esx.Name}},Name,FreeSpaceMB,CapacityMB
$report += '' | Select @{N='VMHost';E={'Total'}},@{N='Name';E={''}},
@{N='FreeSpaceMB';E={($report | Measure-Object -Property FreeSpaceMb -Sum).Sum}},
@{N='CapacityMB';E={($report | Measure-Object -Property CapacityMB -Sum).Sum}}
$report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, This is exactly what I want.