PowerCli on OSX

Step 1 – Download and Install .NET Core for Mac OS X from here

https://www.microsoft.com/net/core#macos

  1. brew update
  2. brew install openssl
  3. ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
  4. ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Step 2 – Download and Install PowerShell for Mac OS X using the instructions and packages this will also include the install of homebrew

https://github.com/PowerShell/PowerShell

  1. Sudo installer -pkg powershell-6.0.0-alpha.10.pkg -target /

Step 3 – Perform the following steps to ensure you are using the latest OpenSSL and Curl:

  1. brew install openssl
  2. brew install curl –with-openssl
  3. sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib /usr/local/microsoft/powershell/6.0.0-alpha.10/System.Net.Http.Native.dylib
  4. sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/microsoft/powershell/6.0.0-alpha.10/System.Security.Cryptography.Native.dylib

Step 4 – Create the following directory if it does not exists by running the following command:

  1. mkdir -p ~/.local/share/powershell/Modules

Step 5 – Extract the PowerCLI modules into the directory you created above by running the following command:

  1. Copy the unzip files to ~/.local/share/powershell/Modules
  2. unzip PowerCLI.ViCore.4523941.zip -d ~/.local/share/powershell/Modules
  3. unzip PowerCLI.Vds.4523941.zip -d ~/.local/share/powershell/Modules

Launch PowerShell

Step 1 – Open terminal

Step 2 – Start Powershell in the terminal by running the following command: powershell

Step 3 – Import the PowerCLI Modules into your PowerShell Session: Get-Module -ListAvailable PowerCLI* | Import-Module

Step 4 – Connect to your vCenter Server using

Connect-VIServer PS> Connect-VIServer -Server 192.168.1.51 -User administrator@vSphere.local -Password VMware1! Name Port User —- —- —- 192.168.1.51 443 VSPHERE.LOCAL\Administrator