vSphere PowerCLI Cmdlets Reference

Copy-DatastoreItem

Synopsis

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

Syntax

Copy-DatastoreItem [-Item] <Object[]> [[-Destination] <Object>] [-Force] [-PassThru] [-Recurse] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version

Detailed Description

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

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
ItemObject[]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.truetrue (ByValue)
DestinationObjectSpecify 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.falsefalse.
ConfirmSwitchParameterIf 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.falsefalse$true
ForceSwitchParameterIndicate whether to overwrite all items with the same name at the provided destination.falsefalse$false
PassThruSwitchParameterIndicate that the cmdlet returns the copied item.falsefalse$false
RecurseSwitchParameterIndicate that you want to copy not only the item, but its children items as well.falsefalse$false
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

FileInfo or DatastoreItem

Notes

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

Examples

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

Copy-DatastoreItem ds:\VM\* c:\VMFolder\VM\

Copies all items in the VM folder in the datastore provider locally to c:\VMFolder\VM\.

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

Copy-DatastoreItem c:\VMFolder\NewVM\* ds:\VM\ -Force

Copies all files in the NewVM local folder to the VM folder in the datastore provider.


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