Install PowerShell PowerCLI and PowerNSX on Apple MacOS

Install Brew

  • Install powershell via Brew
    • If you do not have Brew installed you can follow the instructions on Brew’s Website
    • Or….
      • open a terminal window on Mac
      • Run: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • If you do not have a terminal window open, open one up!
  • Install powershell via brew
    • run: brew cask install powershell

      • Updating Homebrew...
                                ==> Satisfying dependencies
                                All Formula dependencies satisfied.
                                ==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v6.1.3/powershell-6.1.3-osx-x64.pkg
                                ==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/49609581/6f677680-3071-11e9-9cb5-0f9171c27618?X-Amz-Al
                                ######################################################################## 100.0%
                                ==> Verifying SHA-256 checksum for Cask 'powershell'.
                                ==> Installing Cask powershell
                                ==> Running installer for powershell; your password may be necessary.
                                ==> Package installers may write to any location; options such as --appdir are ignored.
                                Password:
                                installer: Package name is PowerShell - 6.1.3
                                installer: Installing at base path /
                                installer: The install was successful.
                                🍺  powershell was successfully installed!
                                
  • After Power Shell is installed
  • Run powershell
    • Run: pwsh
    • $ pwsh
                      PowerShell 6.1.3
                      Copyright (c) Microsoft Corporation. All rights reserved.
      
                      https://aka.ms/pscore6-docs
                      Type 'help' to get help.
      
      
                      

Install PowerCLI

  • Install PowerCLI
    • Run: Install-Module -Name VMware.PowerCLI -Scope CurrentUser
    • > Install-Module -Name VMware.PowerCLI -Scope CurrentUser
      
                      Untrusted repository
                      You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running 
                      the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
                      [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
                      
  • If you do not have a signed certificate, then you might want to run this…
    • Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
    • > Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
      
                      Perform operation?
                      Performing operation 'Update PowerCLI configuration.'?
                      [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
                      

Install PowerNSX

  • Run: Install-Module PowerNSX
  • > Install-Module PowerNSX
                                                     
            Untrusted repository
            You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the 
            modules from 'PSGallery'?
            [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
            

Connect to your NSX via vCenter

  • Run: Connect-NsxServer -vCenterServer <vcenterFQDN>
> Connect-NsxServer -vCenterServer labVcenter.foo.com

PowerShell credential request
vCenter Server SSO Credentials
User: username
Password for user username: *********



Version             : 6.3.5
BuildNumber         : 7119875
Credential          : System.Management.Automation.PSCredential
Server              : 10.0.0.10
Port                : 443
Protocol            : https
UriPrefix           : 
ValidateCertificate : False
VIConnection        : labVcenter.foo.com
DebugLogging        : False
DebugLogfile        : \PowerNSXLog-username@-2019_03_07_14_55_38.log

About Daniel Fredrick

Technology enthusiast, Programmer, Network Engineer CCIE# 17094

View all posts by Daniel Fredrick →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.