08 July 2020

PowerCLI on Linux

I've decided to create Linux VM with PowerCLI on it to make my VMware scripting easier and portable.
Below is few easy steps to complete the task:

1. Create VM (private or public cloud)/ physical server and install Linux distribution of your choice, I've installed CentOS 8 

2. Install PowerShell on your Linux server

You can download PowerShell and find installation instructions here:

On CentOS 8 you have to download appropriate rpm and then install it with below command:

[virtworld@centos8 ~]$ sudo dnf install powershell-lts-7.0.2-1.centos.8.x86_64.rpm -y

3. On your linux server go to PowerShell prompt by typing "pwsh" command and install PowerCLI as below:

PS /home/virtworld> Find-Module -Name VMware.PowerCLI
PS /home/virtworld> Install-Module -Name VMware.PowerCLI

4. (Optional) For your home lab you may want to disable SSL cert verification to be able to connect to your vCenter Server (as by default uses self-signed cert)

PS /home/virtworld> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Happy scripting

No comments:

Post a Comment

Popular