Automation

 View Only
  • 1.  Copy-DatastoreItem error

    Posted Mar 10, 2011 01:12 PM

    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



  • 2.  RE: Copy-DatastoreItem error

    Posted Mar 10, 2011 02:21 PM

    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}
    ....


  • 3.  RE: Copy-DatastoreItem error

    Posted Mar 11, 2011 01:35 PM

    Hi,

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

    Vitali

    PowerCLI Team