powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Get-Datastore



NAME
Get-Datastore

SYNOPSIS
Retrieves the datastores available on a vSphere server.

SYNTAX
Get-Datastore [-Server ] [-Id ] [[-Name] ] [-Datacenter ] [-VMHost MHost[]>] [-VM ] [-Entity ] [-Refresh] []


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


PARAMETERS
-Server
Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the co
mmand runs on the default servers. For more information about default servers, see the description of Connect-V
IServer.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Id
Specify the Ids of the datastores you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Name
Specify the names of the datastores you want to retrieve.

Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Datacenter
Specify datacenters to filter the datastores associated with them.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-VMHost
Specify hosts to filter the datastores used by at least one of them.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-VM
Specify virtual machines to filter the datastores used by at least one of them.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Entity
Use this parameter to retrieve only the datastores used by at least one of the specified inventory objects.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Refresh
Indicates that the cmdlet first refreshes the storage system information and then retrieves the specified datas
tores.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
Datastore


NOTES




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

C:\PS>Get-VMHost -Name VMHost1, VMHost2 | Get-Datastore


Retrieves datastores from the VMHost1 and VMHost2 hosts.





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

C:\PS>Get-Datastore MainDatastore* -Datacenter Datacenter1


Retrieves the datastores from the Datacenter1 datacenter that have names starting with MainDatastore.





-------------- Example 3 --------------

C:\PS>Get-Datastore -VM $vm1, $vm2 -Refresh


Refreshes the host storage system and retrieves the datastores that are used by at least one of the specified virtu
al machines.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Get-Datastore.html
New-Datastore
Remove-Datastore
Set-Datastore