Home > PowerCLI, PowerShell, VMware > Adding VMware PowerCLI to your standard PowerShell environment

Adding VMware PowerCLI to your standard PowerShell environment

In order to get access to PowerCLI when using another PowerShell shortcut or environment you can run the following commands which is what happens when you run the VMware provided shortcut.

# Adds the base cmdlets
Add-PSSnapin VMware.VimAutomation.Core
# Add the following if you want to do things with Update Manager
Add-PSSnapin VMware.VumAutomation
# This script adds some helper functions and sets the appearance. You can pick and choose parts of this file for a fully custom appearance.
. "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1"

Note on the last line that there is a space between the “.” and the path to the script. That space is very important as it means we are including or “dot sourcing” the file.

If you want this all to load every time you launch PowerShell you can add these commands to your profile startup scripts. This is a great place to add functions or aliases that you use all the time. The profile is run once when the PowerShell environment is launched.

Categories: PowerCLI, PowerShell, VMware Tags:
  1. No comments yet.
  1. No trackbacks yet.

Switch to our mobile site