Error running Invoke-Vmscript – An error occurred while sending the request. FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

This post was originally published on this site

(EDIT: Same issue already reported here: Invoke-VMScript – An error occurred while sending the request )

 

Hello folks,

 

 

I used to run Invoke-Vmscript againts our Environment to automate Template Creation.
Recently it stopped working, not sure when exactly.  Targeted VM’s OS is “Server 2016”.

 

For example when I’m running the following PoSh:

 

Invoke-VMScript -ScriptText “get-service” -VM $VM -GuestCredential (get-credential)

 

I’m getting the following Error:

 

Invoke-VMScript : 02.04.2019 11:54:59   Invoke-VMScript         An error occurred while sending the request.

At line:1 char:1

+ Invoke-VMScript -ScriptText “get-service” -VM $VM -GuestUser Administ …

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], ViError

    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViC

   ore.Cmdlets.Commands.InvokeVmScript

 

Credentials are correct, I’m seeing a confirmation in the VM Eventlog that the user was sucessfully authenticated. (Eventsource: VGauth, EventID: 1000, Message: vmtoolsd: Username and password successfully validated for ‘Administrator’)
I also see a brief appearance of a cmd.exe in Taskmanager on the VM.
No other related Events in Eventlog.

Also tried different Clients to run the script, and different target VMs too.
I also ensured that the Client running the script is able to access the ESX Host via Port 443 and (because I read it somewhere: 902 works also)

 

No more ideas… anyone else? Thanks for any help!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.