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
Any progress on this? I get the exact same errors when trying to add an esxi 5 to vCenter 5
You are starting the Invoke-VMScript from a 32-bit PowerCLI sessions I assume ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm, actually not quite the same, let me repost as a new question. "Can't add host (ESXi hypervisor) to inventory"
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.
I just wanted to add that after messing with my IE proxy settings with no luck this is what ended up fixing it for me.
Set-PowerCLIConfiguration -ProxyPolicy NoProxy