I was tasked with setting and testing a quick PowerCLI command today and my system was a bit behind. Of course I took to Youtube to find how to get started quickly with PowerCLI but most of the videos I located were too complex. In this quick blog post I’m going to go over the steps I took to update my Windows Environment with PowerShell, Install PowerCLI, and get it up and running.
Note: this procedure is for Windows systems that are connected to the Internet. There are manual ways to install PowerCLI. However, this post doesn’t cover that process. Additionally, there are Prerequisites to installing PowerCLI, check out this link for more information.
First — I checked to see what version of PowerShell (PS) I have installed. I opened a PowerShell command window as Admin and entered the following command. $PSVersionTable. From the output I could see I had 5.1.19041…
I could have also entered $PS.versionTable.PSversion
Note: Newer versions of Windows should have PowerShell installed by default. If you don’t have PowerShell installed follow this guide for 5.1.
Second – Now it was time to install PowerCLI
- Open the PS5 App as Admin
- Run this command to download – Install-Module -Name VMware.PowerCLI
- Read and answer Yes or All when prompted (Be patient it may take a bit)
- Next you’ll need to Set Execution Policies:
- Enter the command – ‘Set-ExecutionPolicy RemoteSigned’
- More info on Execution Policies HERE
- Next command: ‘Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false’
Third – Ensure PowerCLI Commands are working
- With the PowerShell APP open try this commend to see the version of PowerCLI
- ‘Get-PowerCLIVersion’ << Deprecated command, but works for now
- Also ‘Get-Module’ will tell you the version
- Connect to your vCenter Server
- Enter the command ‘Connect-VIServer [FQDN or IP]
- Once Connected try the command ‘Get-VM’ to see a list of VM’s
These commands might seem simple but I was amazed by the amount of trial and effort it took to get PowerCLI up and running. I’m sure there are other issues folks might run into. If you do run into an issue post a comment below and I’ll be glad to help out.