< Back

Copy-DatastoreItem

Sun Jan 19, 2020 6:48 pm

NAME Copy-DatastoreItem



SYNOPSIS

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] [-Recurse] [-Confirm]

[-WhatIf] [<CommonParameters>]





DESCRIPTION

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





PARAMETERS

-Destination <Object>

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.



Required? false

Position? 2

Default value .

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Indicates 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



-Item <Object[]>

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.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-PassThru [<SwitchParameter>]

Indicates that the cmdlet returns the copied item.



Required? false

Position? named

Default value $false

Accept pipeline input? False

Accept wildcard characters? false



-Recurse [<SwitchParameter>]

Indicates 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



-Confirm [<SwitchParameter>]

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



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<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 FileInfo or DatastoreItem objects







NOTES









-------------------------- 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 LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... eItem.html