Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180460

PowerCLI Invoke-VMScript Error

$
0
0

Hello,

 

When running the Invoke-VMScript commandlet I receive an error similar to the following:

 

Invoke-VMScript :    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

 

My code is as follows:

 

add-type @"

using System.Net;

using System.Security.Cryptography.X509Certificates;

 

public class TrustAllCertsPolicy : ICertificatePolicy {

    public bool CheckValidationResult(

        ServicePoint srvPoint, X509Certificate certificate,

        WebRequest request, int certificateProblem) {

 

        return true;

    }

}

"@

 

$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'

[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

 

Invoke-VMScript -vm "test centos7" -scripttext "ls" -guestuser root -guestpassword #####

 

I tried the resolution outlined in the following thread with no success:

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

 

I'm running PowerCLI 12.0 on vSphere 6.5.0.30000 with VMware Tools version 10346.

 

Is my code sound or is there something that I missed?

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 180460

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>