Unable to Invoke powercli command Invoke-VMScript
search cancel

Unable to Invoke powercli command Invoke-VMScript

book

Article ID: 371477

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

  • Invoking powercli Invoke-VMScript command failed with the following error
Invoke-VMScript -VM "VM_NAME" -ScriptText "hostname" -GuestUser "MYUSERNAME" -GuestPassword "MYPASSWORD"

Invoke-VMScript : 04/07/2024 14:33:53    Invoke-VMScript        An error occurred while sending the request.    
At line:9 char:1
+ Invoke-VMScript -VM "VM_NAME" -ScriptText "hostname" -GuestUser "MYUSER...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], ViError
    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
 

 

Environment

  • vSphere 6.x
  • vSphere 7.x

Cause

  • This issue occurs because connectivity from client machine and  ESXi tcp ports 902 or 443 (or both) is blocked by a firewall. 

Resolution

  • Ensure that network connectivity from client machine to ESXi system hosting the virtual machine on tcp ports 902 and 443 is  present.