vSphere Datastore Report

I needed to generate a Datastore report. All the information I was interested in was available in via the Get-Datastore cmdlet, however it was nested deep. Hence churned up a quicky PowerCLI oneliner:

Get-Datastore `
    | Select-Object -ExpandProperty ExtensionData `
    | Select-Object `
        @{Name="Name"; Expression={$_.Name}},`
        @{Name="CanonicalName"; Expression={$_.Info.Vmfs.Extent.DiskName}},`
        @{Name="CapacityGB"; Expression={[int]($_.Summary.Capacity/1GB)}},`
        @{Name="FreeGB"; Expression={[int]($_.Summary.FreeSpace/1GB)}},`
        @{Name="ProvisionedGB";Expression={[int](($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB)}},`
        @{Name="Moref"; Expression={$_.MoRef}} `
    | ft

In case you are interested in the details of a specific datastore, you can filter the output from the previous oneliner, using the Where-Object cmdlet.

Advertisements

2 thoughts on “vSphere Datastore Report

  1. Pingback: LUN Runtime Name | Virtual Drive

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s