Welcoming PowerCLI to the PowerShell Gallery

While I’ve always enjoyed using VMware’s PowerCLI module for PowerShell, it has been a bit annoying having to navigate to the official VMware site, log in, download the bits, agree to terms, and do a thick installation on every workstation or server that needs the code. Which is why I’m quite happy to see the use of Microsoft’s PowerShell Gallery as the new, official distribution method for PowerCLI. You can download the new PowerCLI module version here and see a list of all VMware modules here.

At a high level, using the gallery means having a quite and simple method for distribution for both online and offline deployments of Windows and other operating systems. A quick Find-Module 'VMware.PowerCLI' reveals all of the goodies.

Find-Module VMware.PowerCLI

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
6.5.1.5... VMware.PowerCLI                     PSGallery            This Windows PowerShell module contains VMware.PowerCLI

To install the module, use Install-Module 'VMware.PowerCLI' with the optional -Scope CurrentUser to circumvent administrative requirements. Kyle Ruddy over at VMware has written up a number of goodies covering installation caveats here.

I’m quite happy about this move by VMware.

Additionally, a pair of weird quirks have been fixed:

  • The 6.5.1.x release supports auto loading the functions, which I’m assuming was caused by a wildcard formerly being used in the module manifest. You can read more about this in my Creating a Module Manifest for the PowerShell Gallery and NuGet post.
  • Prompt mangling – in which the “PS C:\” prompt would be replaced with a blank space and text formatting would get squirrely – seems to be gone.

I highly suggest ditching your old thick installation of PowerCLI. That’s the old one that used the MSI deployment method and installed to a non-standard path of C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules. I personally have version 6.5.1.x installed inside of my OneDrive folder to float around my various devices.

Get-Module -ListAvailable VMware*


    Directory: C:\Users\chris\OneDrive\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     6.5.1.5... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Manifest   6.5.1.5... VMware.VimAutomation.Common
Binary     6.5.1.5... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer...}
Manifest   1.0.0.5... VMware.VimAutomation.Sdk            {Get-PSVersion, Get-InstallPath}

In order to leverage OneDrive, I have installed the module using the Gallery and then just migrate the folders and files over to my OneDrive using a script. Note that the use of Install-Module and Update-Module currently depends on finding modules in C:\Program Files\WindowsPowerShell\Modules. I hope there will be native support for OneDrive – or any other path – in the future. If I’m just blind on this issue, please let me know in the comment section below. 🙂

A Note on Availability

I did hit one snag in which the VMware.VimAutomation.Core resource was not available. This had nothing to do with VMware or PowerCLI but simply something on the web tubes being clogged. Here’s an output of the message in case you encounter it in the wild:

Install-Module -Name VMware.PowerCLI -Scope CurrentUser
WARNING: Could not get response from query 'http://www.powershellgallery.com/api/v2/package/VMware.VimAutomation.Core/6.5.1.5374329'.
WARNING: MSG:SourceLocationNotValid «http://www.powershellgallery.com/api/v2/»
[1772,21: Install-Package] Package 'VMware.VimAutomation.Core' failed to install.

That was the only snag I hit. Go forth and enjoy some snazzy new PowerCLI goodness!