ESXi CLIativity – Part 3

09/09/2018

In previous post in this series, one and two, I showed you some examples how to run ESXi CLI commands on a more relaxed way with use of the PuTTY tools and some scripting.

In this post, I would like to introduce two other methods to execute ESXi CLI commands.

PowerSSH

Microsoft Windows PowerShell and VMware PowerCLI are commonly used by VMware admins. The functionality of PowerShell can be extended by adding Modules. Since PowerShell version 5 adding Modules has become very easy with the introduction of repositories (external and internal). A repository is (said irreverently) a kind of app store where you can retrieve modules. The best known repository is the PowerShell Gallery. If this is all new, the link provides information to get your started, as well as many posts about this topic.

A very handy module is Posh-SSH, created by Carlos Perez, which extend PowerShell with SSH and SCP functionality. The following commands will check for the availability of the PowerShell Gallery and installs the Posh-SSH module.

PS C:\Users> Get-PSRepository

Name      InstallationPolicy   SourceLocation
----      ------------------   --------------
PSGallery Untrusted            https://www.powershellgallery.com/api/v2/

The Get-PSRepository should return the PSGallery as one of the repositories.

Read the rest of this entry »