PowerCLI

 View Only
  • 1.  Invoke-VMScript An error occurred while sending the request

    Posted Jul 09, 2019 09:12 PM

    Hi,

    We have a Vcenter(6.5) which includes afew Esxi 6.0 servers(all the servers configured same with 6.0 version, but the server locations are different), we need to send some commands to VM(windows or linux) through powercli and Invoke-VMScript  cmdlet,

    actually it is working fine but just on some of these esxi servers and their VMs, but for other esxi servers' VMs the Invoke function is freezing(20-30sec) and then returns following error when we send a command:

    Invoke-VMScript -ScriptText "pwd"  -VM $VMName -GuestCredential $DCLocalCredential

    Invoke-VMScript : 7/9/2019 11:10:25 PM  Invoke-VMScript         An error occurred while sending the request.

    At line:1 char:1

    + Invoke-VMScript -ScriptText $check  -VM $VMName -GuestCredential $DCL ...

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

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

        + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViC

       ore.Cmdlets.Commands.InvokeVmScript

    any solution?



  • 2.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 09, 2019 09:28 PM


  • 3.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 10, 2019 07:27 AM

    Thank you for your swift response LucD, however I saw this post already, but I didn't figure out where should we add this code to our script exactly or how to use it!

    Can you help me with some clue?

    Does this issue related to vcenter SSL?(we are using valid SSL certificate)



  • 4.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 10, 2019 07:52 AM

    The code mentioned in that reply, is added to the script where you do the Invoke-VMScript (before the Invoke-VMScript line).


    The problem, even with a valid certificate, might be that although the FQDN is mentioned in the certificate, the IP address might not be.



  • 5.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 10, 2019 08:30 AM

    Shall we make any changes on our installed certificates?

    does this code damege our current SSL certificates?



  • 6.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 10, 2019 10:20 AM

    No, it will not touch your certificates.
    It will just ignore the certificate errors.

    When this shows that is indeed an issue with the IP not being in the certificate, you can eventually update the certificates.



  • 7.  RE: Invoke-VMScript An error occurred while sending the request

    Posted Jul 13, 2019 07:37 AM

    Thank You LucD, we had a IP restriction in Esxi firewall.