top of page

PowerCLI Installation Guide

What is PowerCLI?

vSphere PowerCLI is a powerful command line tool that lets you automate all aspects of vSphere management, including networking, storage, virtual machines, tasks, and more. vSphere PowerCLI is distributed as a Windows PowerShell snap-in.


Prerequisites

- Verify that Microsoft .NET 4.5 SP2 is installed, or install it from the Microsoft Web site following the instructions on that Web site.

- Verify that Windows PowerShell 3.0 is installed, or install it from the Microsoft Web site following the instructions on that Web site.



What is PowerShell?

PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.


Get Started


- We will install the PowerCLI on the WIndows Base OS.

Note: PowerShell is installed by default with Windows OS or Windows Server.


Online Installation: You can install PowerCLI directly from the > https://www.powershellgallery.com/ ( Note: Server must have access to external network )


- Run Install-Module -Name VMware.PowerCLI -Confirm:$false -AllowClobber -Force

- Verify if the PowerCLI module is successfully installed and available on your system - Run Get-Module -Name VMware.PowerCLI -ListAvailable

- Now you successfully installed the PowerCLI module via Online in Windows OS


Offline Installation: Download the .zip file with the latest released PowerCLI version from > https://developer.vmware.com/web/tool/vmware-powercli

- You can also do this Run Save-Module -Name VMware.PowerCLI -Path C:\Users\flatosa\Downloads


Note: The module will download and save to this path location C:\Users\flatosa\Downloads

- To retrieve the folder(s) on your machine that contain PowerShell modules, execute the following command > $env:PSModulePath

- Extract the downloaded .zip file to one of the listed path location or Copy and Paste


C:\Users\flatosa\Documents\WindowsPowerShell\Modules

C:\ProgramFiles\WindowsPowerShell\Modules

C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

- Unblock the copied files - cd path_to_powershell_modules_folder and Run Get-ChildItem * -Recurse | Unblock-File

- Verify if the PowerCLI module is available on your system - Get-Module -Name VMware.PowerCLI -ListAvailable

- Now you successfully Setup the Offline PowerCLI module in Windows OS


Issues that I face:


Error: Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.

- Resolution Run Set-ExecutionPolicy Unrestricted ( To set the policy to Unrestricted )

- Another issue come up


Error: Connect-VIServer : 4/22/2022 11:38:52 AM 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.

- Resolution Run Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false


Note: To configure PowerCLI to ignore an invalid certificate

- Now PowerCLI setup is fully functional, I can connect to my ESXi


Note: VMware PowerCLI consists of multiple modules that you can install and use according to your needs and environments. Usually modules correspond to a VMware product.


- Update PowerCLI, Execute the following command to update PowerCLI - Update-Module -Name VMware.PowerCLI

Note: You cannot update the PowerCLI module online if you have installed it by the offline method. In this case, perform an offline installation of the latest PowerCLI version.


Comentarios


bottom of page