Installing VMware.Powercli latest version and Error Invalid server certificate Set-PowerCLIConfiguration

Way long back, After writing my my article VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP, I decided today to upgrade my vSphere PowerCLI to newer version 10 in the office, I am choosing little bit different installation method instead of using exe installer, PowerCLI can be downloaded from Microsoft Powershell PSGallary instead from VMware.com site. Before installation that I will uninstall existing VMware PowerCLI version from Control Panel >> Programs (appwiz.cpl). This way I can ensure no conflict occur after installation from PSGallary and no merger happen. If you are doing fresh installation you can skip this step.

vmware vsphere esxi uninstall or change a program appwiz.cpl vmware powercli older version, upgrade powercli

Once uninstallation of Powercli completed, Open Microsoft Powershell as Administrator. Next command require active internet. Find the module online with command.
Find-Module VMware.PowerCLI

In the information it shows, latest version is 10.x and it is found on online Microsoft PSGallery Repository. Next command will start download the entire repo module, It will take some time as it is around 50 MB of space is required.
Install-Module VMware.PowerCLI

Although it shows untrusted repository, but it is safe and you can press Y to continue. (It shows untrusted because we have to explicitly add it to trusted repo using Set-PSRepository cmdlet), While Installation It shows progressbar, and in my case I received below error as shown on the console.

Connect-VIServer : 6/9/2018 8:05:39 PM  Connect-VIServer                Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect once or to add a permanent exception for this server.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority 'vcsa65'.

At line:1 char:1
+ Connect-VIServer vcsa65
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.
   Cmdlets.Commands.ConnectVIServer

I need error free installation and for this I am running it again using below one-liner command. While Installation It again shows progressbar.
Install-Module VMware.PowerCLI -AllowClobber -Force

vmware vsphere esxi powercli Find-Module Vmware.Powercli  Install-Module  Vmware.PowerCLI allowclobber force.png

Here, After installation is complete, You will not find any vSphere Powercli icon on desktop. To use it open Powershell and type below command.
Import-Module VMware.PowerCLI

Actually this is a Manifest which will load all linked vmware modules in one go. A module manifest is a PowerShell script file you can use to include information about the module. For example, you can describe the author, specify files in the module (such as nested modules), run scripts to customize the user's environment, load type and formatting files, define system requirements, and limit the members that the module exports.

ModuleType Version    Name                                                         ExportedCommands
----------         -------        ----                                                             ----------------
Script            6.7.0.8...   VMware.DeployAutomation                     {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...
Script            6.7.0.8...   VMware.ImageBuilder                              {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Manifest       10.1.0....   VMware.PowerCLI
Script            6.7.0.8...   VMware.Vim
Script           10.1.0....    VMware.VimAutomation.Cis.Core           {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script           10.0.0....    VMware.VimAutomation.Cloud               {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script           10.1.0....    VMware.VimAutomation.Common
Script           10.1.0....    VMware.VimAutomation.Core                  {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script           6.5.4.7...    VMware.VimAutomation.HA                    Get-DrmInfo
Script           7.1.0.7...    VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}
Script           10.0.0....    VMware.VimAutomation.License             Get-LicenseDataManager
Script           10.1.0....    VMware.VimAutomation.Nsxt                  {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script           10.0.0....    VMware.VimAutomation.PCloud             {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInsta...
Script           10.1.0....    VMware.VimAutomation.Sdk                   {Get-InstallPath, Get-PSVersion}
Script           10.0.0....    VMware.VimAutomation.Srm                   {Connect-SrmServer, Disconnect-SrmServer}
Script           10.1.0....    VMware.VimAutomation.Storage             {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...
Script           1.2.0.0       VMware.VimAutomation.StorageUtility   Update-VmfsDatastore
Script           10.1.0....    VMware.VimAutomation.Vds                   {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Script           10.0.0....    VMware.VimAutomation.Vmc                  {Connect-Vmc, Disconnect-Vmc, Get-VmcService}
Script           10.0.0....    VMware.VimAutomation.vROps              {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...
Script           6.5.1.7...    VMware.VumAutomation                         {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...

vmware vsphere powercli esxi, import-Module VMware.PowerCLI, connect-viserver vcsa 6.7 vcenter appliance, set-PowerCLIConfiguration Invalid certificate action ignore, viservermode proxypolicy noproxy.png

While connecting to vCenter I faced below error and it didn't allow me to login, because I was using default self singed vCenter certificate and it was not yet changed.

Connect-VIServer vcsa65

Connect-VIServer : 6/9/2018 8:05:39 PM  Connect-VIServer                Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect once or to add a permanent exception for this server.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority 'vcsa65'.

At line:1 char:1
+ Connect-VIServer vcsa65
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.
   Cmdlets.Commands.ConnectVIServer

To fix this issue use below one time command, this sets powercli invalid certificate action configuration to ignore.
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Next try using same Connect-VIServer  command to connect vCenter and it will be successful. Another setting about Participate in Ceip (Join the Customer Experience Improvement Program in PowerCLI), annoying yellow warning shows you when importing module, You can suppress it with below 2 commands.

To join the CEIP, run the following command. Set-PowerCLIConfiguration -ParticipateInCeip $true

To leave the CEIP, run the following command. Set-PowerCLIConfiguration -ParticipateInCeip $false

Useful Articles
PART 1 : BUILDING AND BUYING GUIDE IDEAS FOR VMWARE LAB
PART 2 : BUILDING AND HARDWARE BUYING GUIDE IDEAS FOR VMWARE LAB
PART 3 : MY VSPHERE LAB CONFIGURATION ON VMWARE WORKSTATION
PART 4 : CONFIGURING VMWARE WORKSTATION NETWORKING IN HOME LAB



via Latest imported feed items on VMware Blogs https://ift.tt/2MfAW5g
RSS Feed

If New feed item from https://blogs.vmware.com/feed, then send me an email at kr

IFTTT

Comments

Popular posts from this blog

Evernote cuts staff as user growth stalls

The best air conditioner

We won't see a 'universal' vape oil cartridge anytime soon