Virtual Dennis

Installing VMware PowerCLI Cmdlets from the PowerShell Gallery

Manuals & How-To's PowerShell VMware

A great writeup for this process with detailed information is located here: https://blogs.vmware.com/PowerCLI/2017/04/powercli-install-process-powershell-gallery.html In a nutshell: [code language=“powershell”] Find-Module -Name VMware.PowerCLI [/code] You might be prompted for a new version of “NuGet”, which is fine- go ahead and say “yes” to the prompt to install. Then proceed with the below. [code language=“powershell”] Install-Module -Name VMware.PowerCLI -Scope CurrentUser [/code] Once that completed, the VMware PowerCLI Cmdlets were installed. However, when running [code language=“powershell”]Connect-VIServer[/code] I got the following error: Import-Module : File \\vmware-host\Shared Folders\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\1.0.0.5334677\VMware.VimAutomation.Sdk.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. So I went ahead and did the following: - Launch the Windows PowerShell app using the “Run As Administrator” option. Then type in: [code language=“powershell”] Set-ExecutionPolicy RemoteSigned [/code] Once that was done, then [code language=“powershell”]Connect-VIServer[/code] worked.