Retrieving datastores

You can use the Get-Datastore cmdlet to retrieve a specific datastore or a list of all of your datastores. The syntax of the Get-Datastore cmdlet is as follows:

Get-Datastore [-Server <VIServer[]>] [[-Name] <String[]>] [-Location <VIObject[]>] [-RelatedObject <DatastoreRelatedObjectBase[]>] [-Refresh] [-Tag <Tag[]>] [<CommonParameters>]
Get-Datastore [-Server <VIServer[]>] -Id <String[]> [-Refresh] [<CommonParameters>]

The –Id parameter is required.

In the next example, we will retrieve the datastore with the name Cluster01_Vmfs01:

PowerCLI C:\> Get-Datastore -Name Cluster01_Vmfs01

The following is the output of the preceding command:

Name                               FreeSpaceGB      CapacityGB
----                               -----------      ----------
Cluster01_Vmfs01 248,801 249,750 ...

Get Learning PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.