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 ---- ----------- ---------- Cluster01_Vmfs01 248.801 ...