Hi,
I am writing a script that use invoke-vmscript and Copy-VMGuestFile but they throw an error when I run them again the vcenter server.
Here one example:
Invoke-VMScript -ScriptText $NetworkSettings -VM $VMName -GuestCredential $credential
Invoke-VMScript : 01/04/2019 10:56:52 Invoke-VMScript An error occurred while sending the request.
At C:\Users\user\Documents\vscodeProjects\SupportTeam\Vmware-Automation\Actions\CONFIGNET\ActionCONFIGNET.psm1:43 char:5
+ Invoke-VMScript -ScriptText $NetworkSettings -VM $VMName -GuestCr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-VMScript], ViError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
To notice that I connected correctly to the vcenter before run the Invoke-Script and that the script contained in $NetworkSettings has been run correctly on the guest VM. The only problem seems to happen when the Invoke-VMScript try to read the result. If I run the Invoke-VMScript again the physical host instead the VCenter everything is working.
Vcenter, physical host and the machine who the invoke-vmscript are in the same network.
Same problem if I use the Copy-VMGuestFile
Any ideas?