PowerCLI cmdlet Copy-DatastoreItem does not function as expected to vSAN datastore
book
Article ID: 326992
calendar_today
Updated On:
Products
VMware vSAN
VMware vSphere ESXi
Show More
Show Less
Issue/Introduction
Symptoms:
PowerCLI cmdlet Copy-DatastoreItem returns an error when attempting to copy files to a vSAN datastore.
Copy-DatastoreItem : Upload of file 'C:\filename.ext' failed. Error message: Error while copying content to a stream. At line:1 char:1 + Copy-DatastoreItem -Item c:\FileZilla_3.46.2_win64-setup.exe "vmstore ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Copy-DatastoreItem], VimException + FullyQualifiedErrorId : Client20_StorageServiceImpl_UploadFile_UploadFailed,VMware.VimAutomation.ViCore.Cmdlets. Commands.CopyDatastoreItem When attempting to copy a file to a folder on a vSAN datastore, an error is returned. Copy-DatastoreItem : 2/20/2020 1:18:58 PM VimDatastore The specified location '\LastConnectedVCenterServer\Datacenter_name\vsanDatastore\folder_name' does not exist. At line:1 char:1 + Copy-DatastoreItem -Item c:\filename.ext "vmstore ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (:) [Copy-DatastoreItem], PathException + FullyQualifiedErrorId : Core_VmStoreProviderCache_GetItem_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.CopyDatastoreItem
Environment
VMware vSAN 8.0.x VMware vSAN 6.x VMware vSAN 7.0.x
Cause
It is not possible to copy a file to the root folder of a vSAN datastore, as it is an object-based, and not a file-based, distributed storage system. Files must be placed in a folder (namespace object). A file upload in GUI must be to a specified target folder.
Upload Files or Folders to vSAN Datastores
Resolution
In order to copy files to or from a vSAN datastore folder using Copy-DatastoreItem , specify the object UUID of the target folder in the cmdlet. Example usage of the Get-VSANDatastoreFolders function with Copy-DatastoreItem cmdlet:PS C:\Windows\system32> $datastore = Get-Datastore -Name vsanDatastore PS C:\Windows\system32> Get-VSANDatastoreFolders -Datastore $datastore -Server 10.10.10.10 Name Path ---- ---- folder1 [vsanDatastore] ########-####-####-####-########17ad folder2 [vsanDatastore] ########-####-####-####-########662e PS C:\Windows\system32> Copy-DatastoreItem c:\filename.ext vmstore:\Datacenter_name\vsanDatastore\########-####-####-####-########17ad\filename.extNOTE: The only approved method for migrating VMs to and from vSAN is storage vMotion. The above method is not to be used when migrating VMs to and from vSAN.
Feedback
thumb_up
Yes
thumb_down
No