vSphere PowerCLI Cmdlets Reference

Get-Datastore

Synopsis

Retrieves the datastores available on a vSphere server.

Syntax

Get-Datastore [-Server <VIServer[]>] [[-Name] <String[]>] [-Datacenter <Datacenter[]>] [-VMHost <VMHost[]>] [-VM <VirtualMachine[]>] [-Entity <VIObject[]>] [-Refresh] [<CommonParameters>]

Related Commands

Online version
New-Datastore
Remove-Datastore
Set-Datastore

Detailed Description

Retrieves the datastores available on a vSphere server. Returns a set of datastores that correspond to the filter criteria defined by the cmdlet parameters. To specify a server different from the default one, use the -Server parameter.

Parameters

NameDescriptionRequired?Pipeline InputDefault Value
ServerSpecify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
NameSpecify the names of the datastores you want to retrieve.falsefalse
DatacenterSpecify datacenters to filter the datastores associated with them.falsetrue (ByValue)
VMHostSpecify hosts to filter the datastores used by at least one of them.falsetrue (ByValue)
VMSpecify virtual machines to filter the datastores used by at least one of them.falsetrue (ByValue)
EntityThis parameter serves as a generic equivalent to the Datacenter, VM and VMHost parameters. You can pass simultaneously a collection of datacenters, virtual machines, and virtual machine hosts instead of passing them separately through the respective parameters.falsefalse
RefreshIndicates that the cmdlet first refreshes the storage system information and then retrieves the specified datastores.falsefalse

Return Type

Datastore

Notes

Examples

-------------- Example 1 --------------

Get-Datastore -VMHost (Get-VMHost -Id HostSystem-host-8)

Retrieves a list of the datastores on the virtual machine host with ID HostSystem-host-8.

-------------- Example 2 --------------

$datastores = Get-Datastore | where {$_.type -eq "NFS"}

Lists all the datastores of the Vmfs file type.


Copyright © 1998 - 2010 VMware, Inc. All rights reserved.