Can I use PowerCLI to total the "provioned storage" field for all vmdks on a vm, then total the "Used storage" field visible in vsphere client, then find out how much total space is provisioned vs how much is used for a VM?
You can store the VM in a variable, and then do your calculations directly on the properties
$vm = Get-VM -Name MyVM
$vm.ProvisionedSpaceGB - $vm.UsedSpaceGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm afraid the used storage for a VM is monitored by datastore, not per VMDK.
The totals are directly available
Get-VM |
Select Name,ProvisionedSpaceGB,UsedSpaceGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK great thanks. How would I format output so that those values, provisionedspaceGB and UsedSpaceGB are stored in variables that I can do math on in my next line? (When I use "select", it puts it in table format)
You can store the VM in a variable, and then do your calculations directly on the properties
$vm = Get-VM -Name MyVM
$vm.ProvisionedSpaceGB - $vm.UsedSpaceGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK great thanks