First we need install Powershell

# Update the list of packages
 sudo apt-get update
# Install pre-requisite packages.
 sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
 wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
 sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
 sudo apt-get update
# Enable the "universe" repositories
 sudo add-apt-repository universe
# Install PowerShell
 sudo apt-get install -y powershell
# Start PowerShell
 pwsh

After we have started PowerShell we are able to install the PowerCLI module

PS /tmp> install-module -name VMware.PowerCLI
 Untrusted repository
 You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
 'PSGallery'?
 [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
                                                                                                                                                                                                                              Installing package 'VMware.PowerCLI'                                                                                                                                                                                           Installing dependent package 'VMware.VimAutomation.Nsxt'                                                                                                                                                                    [ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo                                                                                                               ]         Installing package 'VMware.VimAutomation.Nsxt'                                                                                                                                                                                 Copying unzipped package to '/tmp/557378897/VMware.VimAutomation.Nsxt.12.0.0.15939671'                                                                                                                                      [ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo    

Now we are able to connect to our ESXi / vCenter server – but first set to ignore Certificate warnings

PS /tmp> 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 WebOperationTimeout
                                                                                                   Seconds
 -----    -----------     ------------------- ------------------------  -------------------------- -------------------
 Session  UseSystemProxy  Multiple            Ignore                    True                       300
 User                                         Ignore
 AllUsers


PS /tmp> Connect-VIServer -Server 192.168.x.x
 Specify Credential
 Please specify server credential
 User: <username>
 Password for user <username>: **
 Name                           Port  User
 ----                           ----  ----
 192.168.x.x                  443   <username>
Leave a Reply

Your email address will not be published.