powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Copy-DatastoreItem



NAME
Copy-DatastoreItem

SYNOPSIS
Copies items between datastores and between a datastore and a local file system provider.

SYNTAX
Copy-DatastoreItem [-Item] [[-Destination] ] [-Force] [-PassThru] [-Recurse] [-WhatIf] [-Confirm
] []


DESCRIPTION
Copies items between datastores and between a datastore and a local file system provider.


PARAMETERS
-Item
Specify 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.

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

-Destination
Specify the destination where you want to copy the datastore item. You can use a string to specify a relative p
ath to the destination object in the current provider location.

Required? false
Position? 2
Default value .
Accept pipeline input? false
Accept wildcard characters? false

-Force
Indicate whether to overwrite all items with the same name at the provided destination.

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

-PassThru
Indicate that the cmdlet returns the copied item.

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

-Recurse
Indicate that you want to copy not only the item, but its children items as well.

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

-WhatIf
Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modi
fied.

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

-Confirm
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.

Required? false
Position? named
Default value $true
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
FileInfo or DatastoreItem


NOTES


Supported only on servers that are ESX 3.5 and vCenter 2.5, and higher.

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

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


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





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

C:\PS>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 --------------

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


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





-------------- Example 4 --------------

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


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






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Copy-DatastoreItem.html