Home > Blogs > VMware PowerCLI Blog


Welcome PowerCLI to the PowerShell Gallery – Install Process Updates

PowerCLI 6.5.1 has been released and in this release we have made some big changes to the way you install and keep up to date with PowerCLI! This update was all based around Microsoft PowerShell deployment models, listening to you, the customer and ensuring we are making the changes to provide the best PowerShell product going forward.

As of PowerCLI 6.5.1, you no longer have a MSI file to download and install. You can now install directly from the PowerShell Gallery! This update streamlines the install process in multiple ways and allows module based features which PowerShell users will be used to from other PowerShell based additions.

What does this mean for you?

PowerCLI being on the PowerShell Gallery means there are some changes that users should be aware of. The first big change, there is no more MSI to perform the install and therefore you don’t download it from the VMware website!

The install is done completely through PowerShell itself using the PowerShell Gallery via PowerShellGet. This means also means the other items which used to be installed by way of the MSI won’t be installed automatically. These things include the PowerCLI desktop shortcuts and the User Guide.

There are two ways in which you may install PowerCLI with this new method, online and offline. Let’s take a look at how to perform these methods.

Getting Started

The first step in moving to this new release is to uninstall any prior versions of PowerCLI which may be installed on the system by the old MSI installer, this is needed to move to the new distribution model.

Uninstalling Prior PowerCLI Versions

It is also worth checking to ensure the “PowerCLI” folder has been removed from the following directory: C:\Program Files (x86)\VMware\Infrastructure\

With the prior version of PowerCLI uninstalled, it’s time for the install!

Online Installation From a Computer with an Internet Connection

For the online install, start by confirming access to PowerShell Gallery and being able to find the PowerCLI module. This can be done by running the following:

Find-Module -Name VMware.PowerCLI

Find-Module Output for PowerCLI

Note: If you have not accessed the PowerShell Gallery before, or perhaps have an out of date version of NuGet, you may receive a message indicating there is a missing or out-of-date NuGet provider. NuGet is a Package Management provider. These are primarily used to install, upgrade, configure, and/or remove software in an automated fashion. To accept the installation of a proper version of NuGet, hit “Y”.

We will now make use of the Install-Module cmdlet to make PowerCLI actually available on the local system. This can be done with the following:

Install-Module -Name VMware.PowerCLI –Scope CurrentUser

You will notice we’re only installing it for the current user, we do this because it doesn’t require admin access! If you would like it available for all users of the computer, your PowerShell session will have to be running as an administrator, and PowerCLI will automatically be installed for all users by changing the Scope parameter to AllUsers.

Install-Module usage

Success! We now have the PowerCLI modules installed and available locally!

Offline Install of PowerCLI to a Computer Without an Internet Connection

The following method should be used to install PowerCLI through the PowerShell gallery for those systems which do not have access to the internet. You will need at least one system that has internet access and a way to move the files to the target computer.

While on a system that has internet access, we will find the PowerCLI module with the same command we ran above:

Find-Module -Name VMware.PowerCLI

Then we can download the module for offline consumption with the following command:

Save-Module -Name VMware.PowerCLI -Path C:\Path\To\Desired\Folder

Save-Module Output

At this point, we’ll want to copy those downloaded folders and place them on the system without internet access in a location where PowerShell can find them, this is the modules folder and can be confirmed by typing $ENV:PSModulePath at the powershell prompt.

Local User: $home\Documents\WindowsPowerShell\Modules
All Users: $pshome\Modules

Using PowerCLI

One of the great enhancements in PowerCLI 6.5.1 means we no longer need to load the modules into the PowerShell session as we may have done in the past, as soon as the modules are loaded into the module folder PowerShell will automatically be aware of their existence and you will find the cmdlets registered with the PowerShell session. Normal PowerShell behaviour meanst that as soon as you use the first cmdlet the PowerCLI module will be loaded as needed.

But what about the nice PowerCLI Welcome message and other functions which existed to make PowerCLI easier to use when we launched the old desktop icon?

First, we can mimic the desktop shortcuts by simply running:

Import-Module VMware.PowerCLI

Import-Module VMware.PowerCLI Output

Please note the warning message about joining the Customer Experience Improvement Program (CEIP). We recommend enabling CEIP, as it’s greatly helps us improve our products! In order for the message to not appear, you either have to enable or disable CEIP by way of the Set-PowerCLIConfiguration cmdlet.

The other option to load the cmdlets, simply use the cmdlets as you normally would. The modules will auto-populate as necessary!

Here’s an example of using a new PowerShell session and connecting to a vCenter Server:

PowerCLI Autoloading Example

We can see the session begins without any PowerCLI modules being imported. After typing in the Connect-VIServer cmdlet (tab complete is fully operational as well), we can see the VMware.VimAutomation.Core module has been imported automatically! The other modules won’t be imported until they’re referenced.

Re-Creating The Desktop Shortcut

I know there are quite a few fans of the Desktop shortcut, so I’ll briefly describe how to set that up. First, create a shortcut that points to the PowerShell executable and place it on the desktop. Next, right click the newly created desktop shortcut and select properties. You should find yourself on the “Shortcut” tab. Enter the following values:

Target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noe -c "Import-Module VMware.PowerCLI"
Start In: C:\
Shortcut Key: None
Run: Normal Window
Comment: Launch VMware PowerCLI

In the end, we should have something quite similar to the following:
Recreating the PowerCLI Desktop Shortcut

Summary

This new install method is a very exciting improvement for PowerCLI. As seen above, this definitely streamlines the process of getting PowerCLI installed and accessible!

To find out more about the other fantastic improvements that are available with VMware PowerCLI 6.5.1, please see the following blog: New Release – PowerCLI 6.5.1

This entry was posted in General and tagged on by .
Kyle Ruddy

About Kyle Ruddy

Kyle Ruddy is a Senior Technical Marketing Engineer at VMware in the Cloud Platform Business Unit. Kyle currently focuses on vSphere with Operations Management as well as all things API, SDK, and CLI. Kyle can be found blogging on VMware blogs, http://blogs.vmware.com/vSphere and http://blogs.vmware.com/PowerCLI, and his personal blog, http://www.thatcouldbeaproblem.com. You can follow Kyle on twitter as @kmruddy.

18 thoughts on “Welcome PowerCLI to the PowerShell Gallery – Install Process Updates

  1. Pingback: New Release: PowerCLI 6.5.1 - VMware PowerCLI Blog - VMware Blogs

  2. Damien Solodow

    Yay!!!
    Excellent to see. 🙂
    One note; since VMware.vimautomation.core contains -cluster cmdlets, if you have the FailoverClusters module installed you’ll need to add the -AllowClobber parameter to the Install-Module command.

    Reply
  3. Pingback: New Release: PowerCLI 6.5.1 – VMpro.at

  4. Gabrie van Zanten

    Hi, when using the desktop shortcut, would that mean it won’t get loaded in other PowerShell windows? Because there are some overlaps like Get-VM between VMware PowerCLI and Hyper-V, we really need the different windows to work in.

    Reply
    1. LucD

      Dear Gabrie,
      No you don’t need a separate window (that’s so 20th century btw)

      You have some options
      1) If you have conflicting cmdlets, add the module name in front

      VMware.VimAutomation.Core\Get-Cluster

      2) Use the Prefix parameter

      Import-Module -Name VMware.VimAutomation.Core -Prefix Pcl
      Get-PclCluster

      3) Unload the module you are not using

      Remove-Module -Name FailOverClusters

      Reply
    1. Jake Robinson

      Hi Thomas, these advanced functions are not in the Horizon module. You’ll still need to import them.

      Reply
  5. Pasquale Lantella

    I have successfully installed the module locally, but what to publish it on our internal Repository (based on DFS file share) using:

    Publish-Module -Name VMware.PowerCLI -Repository MyRepo -verbose -Force

    and get an Error about dependencies issues for ‘VMware.VimAutomation.Sdk’

    what is the best Method to publish powerCLI to an internal Repository?

    Reply
      1. Pasquale Lantella

        Hi Jake! Here is the complete verbose output, I am Using a German windows 7 with Powershell 5.1

        PS C:\> Publish-Module -Name VMware.PowerCLI -Repository LHSRepo -verbose -Force
        VERBOSE: Repositorydetails, Name = ‘LHSRepo’, Location = ‘\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery’; IsTrusted = ‘True’; IsRegistered = ‘True’.
        VERBOSE: Repositorydetails, Name = ‘LHSRepo’, Location = ‘\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery’; IsTrusted = ‘True’; IsRegistered = ‘True’.
        VERBOSE: Ort der Veröffentlichung: “\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery”.
        VERBOSE: Das Modul “VMware.PowerCLI” wurde in “C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.PowerCLI\6.5.1.5377412” gefunden.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.PowerCLI.
        VERBOSE: Loading module from path ‘C:\Users\u104018\AppData\Local\Temp\605923979\VMware.PowerCLI\VMware.PowerCLI.ps1’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Sdk.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\1.0.0.5334677\VMware.VimAutomation.Sdk.ps1’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Common.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\6.5.1.5335010\VMware.VimAutomation.Common.ps1’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Core.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Core\6.5.1.5374329\VMware.VimAutomation.Core.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Core\6.5.1.5374329\VMware.VimAutomation.ViCore.Cmdlets.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Srm.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Srm\6.5.1.5374694\VMware.VimAutomation.Srm.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Srm\6.5.1.5374694\VMware.VimAutomation.Srm.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.License.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.License\6.5.1.5375648\VMware.VimAutomation.License.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.License\6.5.1.5375648\VMware.VimAutomation.License.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Vds.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Vds\6.5.1.5374428\VMware.VimAutomation.Vds.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Vds\6.5.1.5374428\VMware.VimAutomation.Vds.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.vROps.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.vROps\6.5.1.5375723\VMware.VimAutomation.vROps.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.vROps\6.5.1.5375723\VMware.VimAutomation.vROps.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Cis.Core.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cis.Core\6.5.1.5374323\VMware.VimAutomation.Cis.Core.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cis.Core\6.5.1.5374323\VMware.VimAutomation.Cis.Core.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.HA.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.HA\6.0.0.5314477\VMware.HAModule.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.HA\6.0.0.5314477\VMware.VimAutomation.HA.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.HorizonView.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.HorizonView\7.1.0.5307191\VMware.VimAutomation.HorizonView.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.HorizonView\7.1.0.5307191\VMware.VimAutomation.HorizonView.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.PCloud.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.PCloud\6.5.1.5376282\VMware.VimAutomation.PCloud.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.PCloud\6.5.1.5376282\VMware.VimAutomation.PCloud.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Cloud.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cloud\6.5.1.5375799\VMware.VimAutomation.Cloud.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cloud\6.5.1.5375799\VMware.VimAutomation.Cloud.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.DeployAutomation.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.DeployAutomation\6.5.1.5299608\Initialize-VMware_DeployAutomation.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.DeployAutomation\6.5.1.5299608\VMware.DeployAutomation.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.DeployAutomation\6.5.1.5299608\VMware.DeployAutomation.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.ImageBuilder.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.ImageBuilder\6.5.1.5299608\VMware.ImageBuilder.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.ImageBuilder\6.5.1.5299608\VMware.ImageBuilder.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.Storage.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Storage\6.5.1.5374001\VMware.VimAutomation.Storage.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Storage\6.5.1.5374001\VMware.VimAutomation.Storage.Commands.dll’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VimAutomation.StorageUtility.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.0\StorageUtility.psm1’.
        VERBOSE: Populating RepositorySourceLocation property for module VMware.VumAutomation.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VumAutomation\6.5.1.5301639\VMware.VumAutomation.ps1’.
        VERBOSE: Loading module from path ‘C:\Users\u104018\Documents\WindowsPowerShell\Modules\VMware.VumAutomation\6.5.1.5301639\VMware.VumAutomation.dll’.
        VERBOSE: Repositorydetails, Name = ‘LHSRepo’, Location = ‘\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery’; IsTrusted = ‘True’; IsRegistered = ‘True’.
        VERBOSE: Der Anbieter “PowerShellGet” wird für die Paketsuche verwendet.
        VERBOSE: Die angegebenen Quellnamen werden verwendet: ‘LHSRepo’.
        VERBOSE: Das Anbieterobjekt für den PackageManagement-Anbieter “NuGet” wird abgerufen.
        VERBOSE: Der angegebene Speicherort ist “\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery”, und PackageManagementProvider ist “NuGet”.
        VERBOSE: Total package yield:’0′ for the specified package ‘VMware.PowerCLI’.
        VERBOSE: Repositorydetails, Name = ‘LHSRepo’, Location = ‘\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery’; IsTrusted = ‘True’; IsRegistered = ‘True’.
        VERBOSE: Der Anbieter “PowerShellGet” wird für die Paketsuche verwendet.
        VERBOSE: Die angegebenen Quellnamen werden verwendet: ‘LHSRepo’.
        VERBOSE: Das Anbieterobjekt für den PackageManagement-Anbieter “NuGet” wird abgerufen.
        VERBOSE: Der angegebene Speicherort ist “\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery”, und PackageManagementProvider ist “NuGet”.
        VERBOSE: Total package yield:’0′ for the specified package ‘VMware.PowerCLI’.
        VERBOSE: Repositorydetails, Name = ‘LHSRepo’, Location = ‘\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery’; IsTrusted = ‘True’; IsRegistered = ‘True’.
        VERBOSE: Der Anbieter “PowerShellGet” wird für die Paketsuche verwendet.
        VERBOSE: Die angegebenen Quellnamen werden verwendet: ‘LHSRepo’.
        VERBOSE: Das Anbieterobjekt für den PackageManagement-Anbieter “NuGet” wird abgerufen.
        VERBOSE: Der angegebene Speicherort ist “\\lhs.stuttgart.de\dfsroot\lhs\scripts\psGallery”, und PackageManagementProvider ist “NuGet”.
        VERBOSE: Total package yield:’0′ for the specified package ‘VMware.VimAutomation.Sdk’.
        Publish-PSArtifactUtility : PowerShellGet kann die Modulabhängigkeit ‘VMware.VimAutomation.Sdk’ des Moduls ‘VMware.PowerCLI’ im Repository ‘LHSRepo’ nicht auflösen. Vergewissern Sie sich,
        dass das abhängige Modul ‘VMware.VimAutomation.Sdk’ im Repository ‘LHSRepo’ verfügbar ist. Wenn dieses abhängige Modul ‘VMware.VimAutomation.Sdk’ extern verwaltet wird, fügen Sie es dem
        ExternalModuleDependencies-Eintrag im PSData-Abschnitt des Modulmanifests hinzu.
        At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1190 char:17
        + Publish-PSArtifactUtility -PSModuleInfo $moduleInfo `
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo : InvalidOperation: (:) [Publish-PSArtifactUtility], InvalidOperationException
        + FullyQualifiedErrorId : UnableToResolveModuleDependency,Publish-PSArtifactUtility

        Reply
  6. Pingback: PowerCLI 6.5.1 Released | Virtual Allan

  7. Pingback: VMware PowerCLI 6.5.1 moves to the PowerShell Gallery - How to Code .NET

  8. LucD

    If you have modules with conflicting cmdlets (ex. Get-Cluster) on your system, use the -NoClobber switch on the Install-Module cmdlet!

    Reply
  9. Pingback: How to install VMware.PowerCLI for the VMware Connection

  10. Nasko

    Hi All,

    When I try to install the VMware.PowerCLI module, it fails with the following error :

    PackageManagement\Install-Package : Package ‘VMware.VimAutomation.Core’ failed to be installed because: The process cannot access the file
    ‘C:\Users\UserName\AppData\Local\Temp\acdc2k22\InternalVimService50.dll’ because it is being used by another process.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
    + … $null = PackageManagement\Install-Package @PSBoundParameters
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidResult: (VMware.VimAutomation.Core:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package ‘{0}’ failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPack
    age

    I have tried with admin and non-admin user. It fails with different *.dll file. I receive the same error when I use save-module.

    If I use verbose, I see non-matching hashes:

    VERBOSE: Completed downloading ‘VMware.VimAutomation.Cis.Core’.
    VERBOSE: Hash for package ‘VMware.VimAutomation.Cis.Core’ does not match hash provided from the server.
    VERBOSE: InstallPackageLocal’ – name=’VMware.VimAutomation.Cis.Core’,

    My OS is Win7 SP1 x64.

    Thanks!
    Nasko

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


*