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 C:\Users\vSaiyan\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
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 False PS C:\>New-Item -path $profile -type file -force PS C:\>Test-Path $profile True
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" .\Initialize-PowerCLIEnvironment.ps1 cd c:\
Save the File and restart powerShell ISE
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 .