I'm having some trouble with Invoke-VMScript. It returns (503) Server Unavailable when invoking a script that takes pretty long to execute (about 8-10 minutes). The script is actually an msiexec call which runs an msi installer. The installer finishes just fine, everything is installed, and when finished, I get:
Invoke-VMScript : 10/19/2011 8:38:53 PM Invoke-VMScript The remote server returned an error: (503) Server Unavailable.
At C:\CCNet\test.ps1:27 char:16
+ Invoke-VMScript <<<< -ScriptText $script -ScriptType Bat -vm $iisVm -GuestUser $user -GuestPassword $password
+ CategoryInfo : NotSpecified: (:) [Invoke-VMScript], ViError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
It happenes almost every time I try to run that script, but it also happenes sometimes when I try to run scripts that execute very fast, like "dir"
ESXi 5.0 running two Win 2008 R2 64bit VMs.
The call is made from one VM to the other. Both VMs have latest VMWare Tools 8.6.0 installed, as well as PoweCLI 5.0.0 and VMWare VIX 1.10.0
After some digging through the logs, in hostd.log we found:
During execution of the script (maybe it has nothing to do with it):
2011-08-24T13:27:18.559Z [20E94B90 verbose 'Default'] Timed out reading between HTTP requests. : Read timeout after approximately 50000ms. Closing stream TCP(local=127.0.0.1:8309, peer=127.0.0.1:57098)
later on, exactly when the script finished executing, it logs:
2011-08-24T13:29:32.843Z [FFBA8A90 warning 'Proxysvc Req00165'] Connection to localhost:8309 failed with error N7Vmacore21InvalidStateExceptionE(Invalid state).
At this time, the script returns the error described above
I had the same error when trying to use Invoke-VMscript. My solution was to disable to proxy setting in Internet Explorer. I had to completely disable proxy settings, excluding the hosts and virtual center servers was not enough.