import-PowerCLI

For my work I use PowerCLI a lot, but I don’t like the shell that is available when installing PowerCLI. I just want to start PowerShell (mostly through PowerShell ISE) and load with one command the PowerCLI modules and/or snapins and not be limited.

Before PowerCLI 6.5, PowerCLI was a mix of powershell snappins and modules. To support older PowerCLI versions, the script will check if there are vmware powershell snappins registered. And will load them.
Powershell modules will have precedence over the snappins.

To use it is simple.
Start Powershell by opening a powershell shell, or to start the PowerShell ISE
In the shell windows type:

\import-powercli.ps1

The script will return which PowerCLI modules and/or snappins are loaded, like

Loading VMware PowerCLi …

Name Version type
—- ——- —-
VMware.DeployAutomation 6.0.0.0 module
VMware.ImageBuilder 6.0.0.0 module
VMware.VimAutomation.Cis.Core 6.5.0.4624453 module
VMware.VimAutomation.Cloud 6.5.0.4624821 module
VMware.VimAutomation.Common 6.5.0.4624451 module
VMware.VimAutomation.Core 6.5.0.2604913 module
VMware.VimAutomation.HA 6.0.0.0 module
VMware.VimAutomation.HorizonView 7.0.2.4596620 module
VMware.VimAutomation.License 6.5.0.4624822 module
VMware.VimAutomation.PCloud 6.5.0.4624825 module
VMware.VimAutomation.Sdk 6.5.0.4624452 module
VMware.VimAutomation.Storage 6.5.0.4624820 module
VMware.VimAutomation.Vds 6.5.0.4624695 module
VMware.VimAutomation.vROps 6.5.0.4624824 module
VMware.VumAutomation 6.0.0.0 module

During execution of the script it will skip modules/snappins that are already loaded.

You can download the import-PowerCLI script from github at https://github.com/brtlvrs/import-PowerCLI 

One thought on “import-PowerCLI”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: