When Invoke-VMscript is called, a connection to the vCenter is made and then a direct connection is made to the ESXi host, where the VM resides.
In most cases, only the vCenter has a valid SSL/TLS Certifcate (signed by a Certification Authority) and the ESXi host has the default configuration with just a self-signed certificate. Therefore, the connection to the vCenter is allowed but the connection attempt to the host is rejected by PowerCli.
This error results:
An error occurred while sending the request.
To avoid this error, do one of the following:
- Install a valid TLS certificate on all ESXi hosts.
- Set the Invalid Certificate Action to a level that allows establishing a connection to the host.
Then run ./Disable-CertsCheck.psl to trust all certificates.