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. The first parameter set is the default:

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

The second parameter set is for retrieving datastores by ID:

Get-Datastore [-Server <VIServer[]>] -Id <String[]>
    [-Refresh] [<CommonParameters>]

The -Id parameter is required.

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

PowerCLI C:\> Get-Datastore -Name Cluster01_Vmfs01


    Name                               FreeSpaceGB      CapacityGB
---- ----------- ...

Get Learning PowerCLI - Second Edition 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.