Blogs

Install VMwasre PowerCLi 10.0.0.7895300 on Ubumtu 18.04

Print Friendly, PDF & Email

 

 

 

Howto Install VMware PowerCLI 10.0.0.7895300 on Ubuntu 18.04

 

# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-linux-x64.tar.gz
or the preview op powershell 6.1
https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.1/powershell-6.1.0-preview.1-linux-x64.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/6.0.2

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.0.2

# Set execute permissions
sudo chmod +x /opt/microsoft/powershell/6.0.2/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/6.0.2/pwsh /usr/bin/pwsh

or the preview op powershell 6.1
https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.1/powershell-6.1.0-preview.1-linux-x64.tar.gz

Download PowerCli 10.0.0.7895300
https://www.powershellgallery.com/packages/VMware.PowerCLI/10.0.0.7895300/Content/VMware.PowerCLI.ps1

sudo pwsh
Install-Module -Name VMware.PowerCLI

Now try VMware PowerClI

Using PowerCLI
Once I had both PowerShell and PowerCLI installed, I created and ran a simple PowerShell script (PCL_Test.ps1) to test it:

Get-Module  -ListAvailable PowerCLI* | Import-Module
Connect-VIServer  -Server 10.0.0.99
Get-VMHost
Get-VM | Select  Name,VMHost, PowerState, MemoryGB
Get-VM | Select  Name, @{N="IP Address";E={@($_.guest.IPAddress[0])}}
$VMs = Get-VM |  Where-Object { $_.PowerState -ne "PoweredOff" -and  $_.Guest.GuestFamily -ne "WindowsGuest" }
$VMs.guest |  Select-Object VM,OSFullName,IPAddress

The start of the output of the script PCL_Test.ps1

https://www.werts.nl