Copy-DatastoreItem Command | Vmware PowerCLI Reference

Copy-DatastoreItem

This cmdlet copies items between datastores and between a datastore and a local file system provider.

Syntax

Copy-DatastoreItem
-Item < Object[] >
[ [-Destination ] < Object > ]
[-Force ]
[-PassThru ]
[-ProgressAction < ActionPreference > ]
[-Recurse ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Item Object[] named
  • pipeline
  • wildcards
Specifies the datastore item you want to copy. You can use a string to provide a relative path to the item in the current provider location. For more information about the PowerCLI datastore provider, run "Get-Help about_vimdatastore".
optional Destination Object 1
Specifies the destination where you want to copy the datastore item. You can use a string to specify a relative path to the destination object in the current provider location. For more information about the PowerCLI datastore provider, run "Get-Help about_vimdatastore".
optional Force SwitchParameter named
Indicates whether to overwrite all items with the same name at the provided destination.
optional PassThru SwitchParameter named
Indicates that the cmdlet returns the copied item.
optional ProgressAction ActionPreference named
optional Recurse SwitchParameter named
Indicates that you want to copy not only the item, but its children items as well.

Output

System.IO.FileInfo

Examples

Example 1

Copy-DatastoreItem vmstore:\Datacenter\Storage1\MyVM\* c:\VMFolder\MyVM\

Copies the contents of a datastore folder in a local folder.

Example 2

Copy-DatastoreItem c:\VMFolder\MyVM\* vmstore:\Datacenter\Storage1\NewVM\ -Force

Copies the contents of a local folder into a datastore folder. If the destination folder does not exist, the Force parameter enforces its creation.

Example 3

Copy-DatastoreItem c:\VMFolder\* vmstore:\Datacenter\Storage1\VMs\ -Force -Recurse

Copies recursively the contents of a local folder into a datastore folder.

Example 4

Copy-DatastoreItem Windows.ISO vmstore:\Datacenter\Storage1\ISOFiles\WinXPSP3.iso

Copies a file into a datastore folder and changes the file name.

Related Commands

Datastore

This cmdlet retrieves the datastores available on a vCenter Server system.

This cmdlet moves datastores from one location to another.

This cmdlet creates a new datastore.

This cmdlet removes the specified datastores from their locations.

This cmdlet modifies the properties of the specified datastore.

DatastoreCluster

This cmdlet retrieves datastore clusters.

This cmdlet creates a new datastore cluster.

This cmdlet deletes the specified datastore clusters.

This cmdlet modifies the configuration of the specified datastore cluster.

DatastoreItem

This cmdlet copies items between datastores and between a datastore and a local file system provider.