VMware Cloud Community
Muhammedali
Contributor
Contributor

Copy-DatastoreItem error

to copy a file from my local machin to the DataStore i used the follwing commands which work perfectly fine

New-PSDrive -Location (Get-Datastore -Server $ConnectServer -Name "NAMe") -Name DSDrive -PSProvider VimDatastore -Root '\'

Copy-DatastoreItem -Item $SourceBuild_ISO -Destination DSDrive:\folder1 -Force

however every once in a while, i get this error as shown in attached.

The error comes special after i have rebooted my local machine and the VM and try copying my files.

Immediately after the error comes, i retry the command after couple of minutes and it works perfectly well.

Any explanations?

Muhammedali

Tags (1)
0 Kudos
2 Replies
LucD
Leadership
Leadership

You probably have to wait till the VMware tools are started in the guest.

You could check the State of the tools before starting the copy.

while ((Get-VM MyVM).Guest.State -ne "Running"){sleep 5}
....


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

admin
Immortal
Immortal

Hi,

It seems that something breaks the established connection. Does your local machine stand behind proxy?

Vitali

PowerCLI Team

0 Kudos