Automation

 View Only
  • 1.  Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Nov 16, 2017 08:24 PM
      |   view attached

    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!



  • 2.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Nov 16, 2017 08:40 PM

    Try like this

    Get-Datastore |

    Select Name,CapacityGB,FreespaceGB,

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



  • 3.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Nov 21, 2017 05:28 PM

    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?



  • 4.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Nov 21, 2017 06:04 PM

    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.



  • 5.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Nov 21, 2017 10:41 PM

    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? 



  • 6.  RE: Accessing Total Provisioned Space on Datastore Summary Tab
    Best Answer

    Posted Nov 22, 2017 05:53 AM

    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}}



  • 7.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Feb 07, 2018 05:53 PM
    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


  • 8.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Feb 07, 2018 06:30 PM

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



  • 9.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Sep 21, 2018 07:32 PM
    hi, this calculation change for vsan datastores? 


  • 10.  RE: Accessing Total Provisioned Space on Datastore Summary Tab

    Posted Sep 21, 2018 08:21 PM

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