Storage‎ > ‎

Get-DatastoreCluster Provisioned

posted Aug 26, 2013, 4:01 AM by Kris Knight   [ updated Jun 14, 2016, 11:42 AM ]
Needed a way to report the provisioned space of a datastore cluster. With a regular datastore I can see this in the summary tab. But it seems to be missing for the Cluster. Once thin provisioning is heavily used, I see this value being used to ensure that provisioned space never exceeds capacity. Thus ensuring guaranteed space while allowing room for snapshots and reducing threat of a LUN off-lining due to snapshot growth. This is what I initially came up with.


$DataStoreClusters = Get-DatastoreCluster

ForEach($DSC in $DataStoreClusters){
    $Provisioned = 0
    $gDSC = Get-DatastoreCluster $DSC | Get-View
    If($gDSC.ChildEntity.Count -gt 0){
        $Datastores = Get-Datastore -Id $gDSC.ChildEntity
        ForEach($DS in $Datastores) {
            $gDS = Get-Datastore $DS
            $Provisioned = [math]::Round(($gDS.ExtensionData.Summary.Capacity - $gDS.ExtensionData.Summary.FreeSpace + $gDS.ExtensionData.Summary.Uncommitted)/1GB,2) + $Provisioned
        }
        Get-DatastoreCluster $DSC | Select Name,CapacityGB,@{N="Provisioned";E={$Provisioned}},@{N="FreeSpace";E={[Math]::Round(($_.FreeSpaceGB),2)}}
    }
}
Comments