VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Accessing Total Provisioned Space on Datastore Summary Tab

I'm looking at the datastore summary tab for a datastore object in vSphere Client and I see what is on the attached screenshot.

I can't seem to find this property on the object in powerCLI.  (At least for purposes of this specific post) I don't want to try to calculate it myself by adding up the individual VMs but I want to try to access the exact same property using PowerCLI which is being displayed in the attached screenshot.

Where can I find this property?  How do I add it to this script:

get-datastore | select name, freespacegb, [access this property somehow here]

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Like I said, for me the values correspond exactly.

It would be interesting to know where the differences you see come from.

Is Monitor-Performance-Space-By File Type showing correct values in your case?

And the recalculation of the numbers can be forced through an API method.

Like this (I most of the time see small changes in the numbers after this call).

$dsName = 'MyDS'

$ds = Get-Datastore -Name $dsName

$ds |

Select Name,CapacityGB,FreespaceGB,

    @{N='ProvisionedGB';E={($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Uncommitted)/1GB}}

$ds.ExtensionData.RefreshDatastoreStorageInfo()

$ds = Get-Datastore -Name $dsName

$ds |

Select Name,CapacityGB,FreespaceGB,

    @{N='ProvisionedGB';E={($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Uncommitted)/1GB}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Datastore |

Select Name,CapacityGB,FreespaceGB,

    @{N='ProvisionedGB';E={($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Uncommitted)/1GB}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

TheVMinator
Expert
Expert
Jump to solution

Somehow this isn't equal to the "provisioned space" on the datstore tab.  When I run this, it gives me 2028GB, but the provisioned space on the datastore tab is 2.3 TB.

Any ideas?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I just checked with a couple of my datastores, and the numbers correspond perfectly.

There must be other data on those datastores that is apparently not taken into account.

Can you check if Monitor-Performance-Space-By Filetype shows something that could explain the difference you are seeing.

Also note that the numbers you see in the Client are only refreshed on an interval.

In the Web Client you have a Refresh button to force a recalculation.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

TheVMinator
Expert
Expert
Jump to solution

OK thanks for the info.  I guess my difficulty is that for everything else I've seen in the GUI, usually there is a way to get it by PowerCLI without too much difficulty.   I was thinking that since "provisioned space" for the entire datastore object was a pretty common thing for people to want to know and see, there must be a PowerCLI way to get it without too much difficulty.

It could be that other data on the datastore such as array snapshots or some other unusual file types are affecting what I see in the GUI for "provisioned space".  However, even if that were the case, isn't there a way with PowerCLI to just get the same number as what I'm seeing in the GUI?  I can't see how that number could be available in vCenter to be called through the Web Client or the vSphere Client, but it can't be called through PowerCLI.

Is this a rare, hard to get metric that would need to be accessed programatically a different way than PowerCLI such as with the web services sdk? 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Like I said, for me the values correspond exactly.

It would be interesting to know where the differences you see come from.

Is Monitor-Performance-Space-By File Type showing correct values in your case?

And the recalculation of the numbers can be forced through an API method.

Like this (I most of the time see small changes in the numbers after this call).

$dsName = 'MyDS'

$ds = Get-Datastore -Name $dsName

$ds |

Select Name,CapacityGB,FreespaceGB,

    @{N='ProvisionedGB';E={($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Uncommitted)/1GB}}

$ds.ExtensionData.RefreshDatastoreStorageInfo()

$ds = Get-Datastore -Name $dsName

$ds |

Select Name,CapacityGB,FreespaceGB,

    @{N='ProvisionedGB';E={($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Uncommitted)/1GB}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BigBlueMike
Enthusiast
Enthusiast
Jump to solution

LucD I think you have a typo.LucD I think you have a typo.
replace
$_.ExtensionData.Uncomitted with $_.ExtensionData.Summary.Uncommitted and then the numbers should add up, at least it did for me
LucD, I think you have a typo (two M's).
 
replace
 
$_.ExtensionData.Uncomitted
 
with
 
$_.ExtensionData.Summary.Uncommitted
 
and then the numbers should add up, at least it did for me.
 
replace
$_.ExtensionData.Uncomitted with $_.ExtensionData.Summary.Uncommitted and then the numbers should add up, at least it did for me
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You are correct, well spotted.
I updated the code snippets above.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
etcheverri
Contributor
Contributor
Jump to solution

hi, this calculation change for vsan datastores? 
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

It's still a datastore, so no, should still be valid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos