Monday, September 30, 2013

PowerShell CLI Command to Get Datastore Usage

The below script will run and return all Datastores with Name like EMC (just an example) and then will return the Capacity of the datastore, the FreeSpace and the Provisioned Space

$DS = get-datastore | where { $_.name -like "EMC*"}
Get-Datastore $DS |Select-Object -Property Name,CapacityGB,FreeSpaceGB,@{ Name = "ProvisionedSpaceGB"
   Expression = {($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB}
 } |fl

No comments:

Post a Comment