PowerCLI: "Initialize-PowerCLIEnvironment.ps1 cannot be loaded because the execution of scripts is disabled on this system."

Whenever you start PowerCLI, you see:

File C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:2
+ . <<<<  "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Script
s\Initialize-PowerCLIEnvironment.ps1"
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
PS C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>

To permanently allow the execution of scripts, Right-click on PowerCLI > Run as Administrator:

PS C:\> Get-ExecutionPolicy
Restricted
PS C:\> Set-ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
PS C:\> Get-ExecutionPolicy
RemoteSigned

6 thoughts on “PowerCLI: "Initialize-PowerCLIEnvironment.ps1 cannot be loaded because the execution of scripts is disabled on this system."”

  1. If that doesn’t work (it didn’t for me), try typing this after you get the error:
    Set-ExecutionPolicy Unrestricted -Force

Leave a Reply

Your email address will not be published. Required fields are marked *