< Back
Get-Datastore
Post
NAME Get-Datastore
SYNOPSIS
This cmdlet retrieves the datastores available on a vCenter Server system.
SYNTAX
Get-Datastore -Id <String[]> [-Refresh] [-Server <VIServer[]>] [<CommonParameters>]
Get-Datastore [[-Name] <String[]>] [-Location <VIObject[]>] [-Refresh] [-RelatedObject
<DatastoreRelatedObjectBase[]>] [-Server <VIServer[]>] [-Tag <Tag[]>] [<CommonParameters>]
DESCRIPTION
This cmdlet retrieves the datastores available on a vCenter Server system. 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
-Id <String[]>
Specifies the IDs of the datastores you want to retrieve.
Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that
matches exactly one of the string values in that list.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Location <VIObject[]>
Specifies vSphere container objects that you want to search for datastores. This parameter accepts Datacenter,
Folder, and DatastoreCluster objects.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Name <String[]>
Specifies the names of the datastores you want to retrieve.
Required? false
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Refresh [<SwitchParameter>]
Indicates that the cmdlet first refreshes the storage system information and then retrieves the specified
datastores.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-RelatedObject <DatastoreRelatedObjectBase[]>
Specifies objects to retrieve one or more Datastore objects that are related to them. This parameter accepts
vSphere VirtualMachine, VMHost, Datacenter, DatastoreCluster, Cluster, Folder, HardDisk, and OMResource
objects, as well as vCloud Datastore objects.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of Connect-VIServer.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Tag <Tag[]>
Returns only the datastores that are associated with any of the specified tags.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more Datastore objects
NOTES
-------------------------- Example 1 --------------------------
Get-VMHost -Name VMHost1, VMHost2 | Get-Datastore
Retrieves datastores from the VMHost1 and VMHost2 hosts.
-------------------------- Example 2 --------------------------
Get-Datastore -Name MyDatastore* -Location MyDatacenter
Retrieves the datastores from the MyDatacenter datacenter that have names starting with MyDatastore.
-------------------------- Example 3 --------------------------
$vm1 = Get-VM -Name myVM1
$vm2 = Get-VM -Name myVM2
Get-Datastore -RelatedObject $vm1, $vm2
Retrieves the datastores for a specified array of virtual machines.
-------------------------- Example 4 --------------------------
$myVMHost = Get-VMHost -Name MyVMHost
Get-Datastore -VMHost $myVMHost -Refresh
Refreshes the host storage system and retrieves its datastores.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... store.html
New-Datastore
Remove-Datastore
Set-Datastore
Move-Datastore
SYNOPSIS
This cmdlet retrieves the datastores available on a vCenter Server system.
SYNTAX
Get-Datastore -Id <String[]> [-Refresh] [-Server <VIServer[]>] [<CommonParameters>]
Get-Datastore [[-Name] <String[]>] [-Location <VIObject[]>] [-Refresh] [-RelatedObject
<DatastoreRelatedObjectBase[]>] [-Server <VIServer[]>] [-Tag <Tag[]>] [<CommonParameters>]
DESCRIPTION
This cmdlet retrieves the datastores available on a vCenter Server system. 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
-Id <String[]>
Specifies the IDs of the datastores you want to retrieve.
Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that
matches exactly one of the string values in that list.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Location <VIObject[]>
Specifies vSphere container objects that you want to search for datastores. This parameter accepts Datacenter,
Folder, and DatastoreCluster objects.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Name <String[]>
Specifies the names of the datastores you want to retrieve.
Required? false
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Refresh [<SwitchParameter>]
Indicates that the cmdlet first refreshes the storage system information and then retrieves the specified
datastores.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-RelatedObject <DatastoreRelatedObjectBase[]>
Specifies objects to retrieve one or more Datastore objects that are related to them. This parameter accepts
vSphere VirtualMachine, VMHost, Datacenter, DatastoreCluster, Cluster, Folder, HardDisk, and OMResource
objects, as well as vCloud Datastore objects.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of Connect-VIServer.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Tag <Tag[]>
Returns only the datastores that are associated with any of the specified tags.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more Datastore objects
NOTES
-------------------------- Example 1 --------------------------
Get-VMHost -Name VMHost1, VMHost2 | Get-Datastore
Retrieves datastores from the VMHost1 and VMHost2 hosts.
-------------------------- Example 2 --------------------------
Get-Datastore -Name MyDatastore* -Location MyDatacenter
Retrieves the datastores from the MyDatacenter datacenter that have names starting with MyDatastore.
-------------------------- Example 3 --------------------------
$vm1 = Get-VM -Name myVM1
$vm2 = Get-VM -Name myVM2
Get-Datastore -RelatedObject $vm1, $vm2
Retrieves the datastores for a specified array of virtual machines.
-------------------------- Example 4 --------------------------
$myVMHost = Get-VMHost -Name MyVMHost
Get-Datastore -VMHost $myVMHost -Refresh
Refreshes the host storage system and retrieves its datastores.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... store.html
New-Datastore
Remove-Datastore
Set-Datastore
Move-Datastore