Initializing PowerCLI Modules in PowerShell ISE

starting from vSphere 6.0 release VMware has started to transform their distribution model of PowerCLI cmdlets from PSSnapins into modules.

so today we are going to show how to load PowerCli Module in PowerShell ISE

The PowerShell Integrated Scripting Environment (ISE) is very handy application when dealing with VMware PowerCLI. When  you write  a script or a one-liner, one of the first things you should do is to load the necessary Modules .  you can automate this process to load necessary Modules automatically when starting PowerShell ISE with the help of the powershell ISE profile . it is a PowerShell script file . Because of this, you can write everything (cmdlets, scripts, functions etc.) in this script file, and it will be executed when you start the PowerShell ISE.

where can you find the Windows PowerShell profile files? The path to the PowerShell profile can found with variable $profile.

PS C:\>$profile

Usually the files doesn’t exist, except you created them. Check if the files exist. If not, this command will create an empty profile file

PS C:\>Test-Path $profile

PS C:\>New-Item -path $profile -type file -force

PS C:\>Test-Path $profile

10-24-2017 7-40-25 AM

after creating $profile  open it with notepad and put the following command this will load the PowerCli Modules when open PowerShell ISE

cd "C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts"
cd c:\

Save the File and restart powerShell ISE

10-24-2017 7-50-25 AM10-24-2017 7-50-39 AM

Now PowerCli loaded as shown and you can start using PowerCLI cmdlet

you can also write script to load correct PowerCLI Modules you are using .

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s