Automation

 View Only
  • 1.  Connect-VIServer The SSL connection could not be established

    Posted May 10, 2021 02:39 PM

    I have installed PowerCLI 12.3 on Powershell 7.1 on Ubuntu 20.04 as can be seen below

    PS /home/mahmood> Get-Module -ListAvailable

    Directory: /home/mahmood/.local/share/powershell/Modules

    ModuleType Version PreRelease Name PSEdition ExportedCommands
    ---------- ------- ---------- ---- --------- ----------------
    Script 12.2.0.17… VMware.CloudServices Desk {Connect-Vcs, Disconnect-Vcs, Ge…
    Script 7.0.2.178… VMware.DeployAutomation Desk {Add-CustomCertificate, Add-Depl…
    Script 7.0.2.178… VMware.ImageBuilder Desk {Add-EsxSoftwareDepot, Add-EsxSo…
    Manifest 12.3.0.17… VMware.PowerCLI Desk
    Script 7.0.2.178… VMware.Vim Desk
    Script 12.3.0.17… VMware.VimAutomation.Cis.Core Desk {Connect-CisServer, Disconnect-C…
    Script 12.0.0.15… VMware.VimAutomation.Cloud Desk {Add-CIDatastore, Connect-CIServ…
    Script 12.3.0.17… VMware.VimAutomation.Common Desk {Get-PowerCLIContext, Get-Task, …
    Script 12.3.0.17… VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-Virt…
    Script 12.3.0.17… VMware.VimAutomation.Hcx Desk {Connect-HCXServer, Disconnect-H…
    Script 12.3.0.17… VMware.VimAutomation.HorizonView Desk {Connect-HVServer, Disconnect-HV…
    Script 12.0.0.15… VMware.VimAutomation.License Desk Get-LicenseDataManager
    Script 12.3.0.17… VMware.VimAutomation.Nsxt Desk {Connect-NsxtServer, Disconnect-…
    Script 12.2.0.17… VMware.VimAutomation.Sdk Desk {Get-ErrorReport, EnableParamete…
    Script 12.3.0.17… VMware.VimAutomation.Security Desk {Add-AttestationServiceInfo, Add…
    Script 12.3.0.17… VMware.VimAutomation.Srm Desk {Connect-SrmServer, Disconnect-S…
    Script 12.3.0.17… VMware.VimAutomation.Storage Desk {Add-EntityDefaultKeyProvider, A…
    Script 1.6.0.0 VMware.VimAutomation.StorageUtility Desk Update-VmfsDatastore
    Script 12.3.0.17… VMware.VimAutomation.Vds Desk {Add-VDSwitchPhysicalNetworkAdap…
    Script 12.2.0.17… VMware.VimAutomation.Vmc Desk {Add-VmcSddcHost, Connect-Vmc, D…
    Script 12.2.0.17… VMware.VimAutomation.vROps Desk {Connect-OMServer, Disconnect-OM…
    Script 12.3.0.17… VMware.VimAutomation.WorkloadManag… Desk {Disable-WMCluster, Enable-WMClu…
    Script 12.1.0.16… VMware.VumAutomation Desk {Add-EntityBaseline, Copy-Patch,…

    Directory: /opt/microsoft/powershell/7/Modules

    ModuleType Version PreRelease Name PSEdition ExportedCommands
    ---------- ------- ---------- ---- --------- ----------------
    Manifest 1.2.5 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archiv…
    Manifest 7.0.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcri…
    Manifest 7.0.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Cle…
    Manifest 7.0.0.0 Microsoft.PowerShell.Security Core {Get-Credential, Get-ExecutionPo…
    Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core {Export-Alias, Get-Alias, Import…
    Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-…
    Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource,…
    Script 2.0.5 PSDesiredStateConfiguration Core {Configuration, New-DscChecksum,…
    Script 2.1.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-P…
    Binary 2.0.3 ThreadJob Desk Start-ThreadJob

    Problem is that the following command fails with an error

    Connect-VIServer -Server "10.1.1.2" -User "administrator@vsphere.local" -Password "PASS"

    Connect-VIServer: /home/mahmood/get_ip_list.ps1:6
    Line |
    6 | Connect-VIServer -Server "10.1.1.2" -User "administrator@vsphere.loca
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | 5/10/2021 7:05:05 PM Connect-VIServer The SSL connection could not be established, see inner
    | exception.

     

    However, I am able to ssh to that vcenter like below

    $ ssh root@10.1.1.2
    VMware vCenter Server Appliance 6.7.0.40000

    Type: vCenter Server with an embedded Platform Services Controller

    root@10.1.1.2's password:
    Connected to service

    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"

    Command>

    Any idea to solve the error?



  • 2.  RE: Connect-VIServer The SSL connection could not be established
    Best Answer

    Posted May 10, 2021 03:37 PM

    Did you check the InvalidCertificateAction setting with Get-PowerCLIConfiguration?
    Try changing it to Ignore with the Set-PowerCLIConfiguration cmdlet.



  • 3.  RE: Connect-VIServer The SSL connection could not be established

    Posted May 11, 2021 11:07 AM

    OK I fixed that.

     

    PS /home/mahmood> Get-PowerCLIConfiguration

    Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTi
    meoutSeconds
    ----- ----------- ------------------- ------------------------ -------------------------- --------------
    Session UseSystemProxy Multiple Unset True 300
    User
    AllUsers

    PS /home/mahmood> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

    Perform operation?
    Performing operation 'Update PowerCLI configuration.'?
    [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y

    Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTi
    meoutSeconds
    ----- ----------- ------------------- ------------------------ -------------------------- --------------
    Session UseSystemProxy Multiple Ignore True 300
    User Ignore
    AllUsers

     

    Thanks