Installing VmWare PowerCli on MacOS

PowerCli is the command line for the VmWare infrastructure.
PowerCli uses Microsoft PowerShell Core and .Net. It might be challenging to get it working on MacOS.

Though PowerShell says its cross-platform, I was facing issues with installing and running it on mac.
Docker to the rescue. VmWare published PowerCliCore DockerFile. With this, installing PowerCli was very easy.

These are the commands I used:
(I am running MacOS High Sierra 10.3.3 and I have docker for mac already installed)

Install and run
$ docker pull vmware/powerclicore
$ docker run –rm -it vmware/powerclicore

To run in daemon mode
$ docker run –name powercli     -dit vmware/powerclicore
$ docker exec -it powercli pwsh

After this point, you will be on the PowerShell prompt and can run regular PowerCli Commands

If vSphere has a self signed certificate, you have to ignore SSL validation for Cli to authenticate successfully
PS /root> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

Connect to vSphere server
PS /root> Connect-VIServer -User administrator@vsphere.local -Server EnterVSphereServerIPHere -Password EnterVSphereServerPasswordHere

Get help on any command (btw, tab completion works)
PS /root> Get-Help Get-VM

Get a vm with name “i-2-88-VM”
PS /root> Get-VM -Name  “i-2-88-VM” | Get-View

PowerCli documentations is available at http://powercli-core.readthedocs.io/en/latest/intro.html

Comments

Popular posts from this blog

Configuring ADFS SSO with Apache CloudStack/CloudPlatform using SAML

A Look at Cloudplatform/Apache CloudStack LDAP Authentication Options