Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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