PowerCLI - datastore capacity with free space percentage (one liner)

This is a one liner that will compute free space percentage as well as dump datastore name, capacity and freespace in GB.

Requires: VMware, Powershell and PowerCLI

Code:

Get-Datastore | Select-Object name, @{name="CapacityGB";Expression={[math]::Round($_.capacitygb,2)}}, @{name="FreeSpaceGB";Expression={[math]::Round($_.freespacegb,2)}}, @{name="PercentFree";Expression={[math]::Round(($_.freespacegb / $_.capacitygb * 100),2)}}

  • powercli, vmware, powershell
  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

PowerCLI - Show all VMs with VM Disks less than % (requires vmtools)

This handy script will report all VMs with VM Disks less than the specified...

PowerCLI - Get IP of VM

Another simple one liner to find a VM by IP (sometimes this times out in the GUI)Requires:...

Powered by WHMCompleteSolution