Load PowerCLI into the PowerShell session as a module

Last year, VMware wrote about “PowerCLI 6.0 – Introducing PowerCLI Modules.”

Although I’ve been using PowerCLI 6.0 since then, I missed the note from Alan Renouf that made it easy to load all of the PowerCLI functionality into a PowerShell session as a module instead of having to launch PowerCLI.

Here was his tip/trick:

1
2
3
if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) {
. “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1”
}

Yea. Thanks Alan.