Installation of Powercli 10.0 on Linux(powercli support for mac/linux)

By | 4th March 2018

Powercli on Linux (

The latest version of Powercli 10.0 supports Linux and Mac. In this blog I am trying to explore powercli on Ubuntu(linux).

Wrote a small bash script which can do the Installation of Powershell Core and Powercli Installation on Ubuntu 16.04

It does the following:-

1. Check if the version is Ubuntu 16.04 or not by codename “Xenial”
2. Add the Powercli Core repo’s to apt source list
3. Install Powercli Core in the Machine
4. Add the PSGallery as trusted and Getting the information of the Repo
5. Start the Installation of the Powercli Module
6. Listing the Modules once the installation is done.

Script uploaded to github:

For using the script:

Download the script into your Ubuntu Machine using wget
  $ wget

Trigger the script using sudo
~$ sudo sh



7. How to run the Powercli Script directly from SHELL use the option -f

e.g. Script to list all the vms
$cat getallvms.ps1
Connect-VIServer -Server -User root -password ‘password’
$myvms = Get-VM
Write-Host “VM names in the host in the format VMName:VMState”
foreach($i in $myvms)
write-Host $i.Name ” : ” $i.PowerState


For running the script from shell

:~$ pwsh -f getallvms.ps1

In case of Certificate error, put the $false as ‘$false’ as we need to escape $ in Linux

~$ pwsh -c Set-PowerCLIConfiguration -invalidcertificateaction ignore -confirm:’$false’

Thanks for reading….

Leave a Reply

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