Install PowerShell Core with PowerCLI on ubuntu 18.04

Steps to install PowerShell Core with PowerCLI on ubuntu 18.04

  1. Switch to root and install PowerShell Core
#Switch to root
su -

# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.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

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh
  1. You can upgrade the PowerShell Core if there is any new version released with
sudo apt-get upgrade powershell
  1. Install VMware PowerCLI
Install-Module -Name VMware.PowerCLI

#Ignore the Selfsign Certificate warning when connecting to vSphere Host / vCenter
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

#Import VMware Module
Import-Module VMware.VimAutomation.Core

#Connect to ESXi host or vCenter
$ESXi = "192.168.1.188"
$User = "root"
$Password = "P@ssw0rd"

Connect-VIServer -Server $ESXi -User $User -Password $Password -WarningAction SilentlyContinue
  1. I try to run Sample Preventive Maintenance Reports which i prepared on my Windows 10 machines and it is working fine

PowerCLI-ubuntu-01

Reference
1. https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top