When you run PowerCLI for the first time after fresh install you might get an error similar to this one. This is because your computer Powershell policy is set to restricted. You can check your current execution policy by running Get-ExecutionPolicy command.
Copy to Clipboard
. : File C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . “C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Init …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\WINDOWS\system32>
In order to change execution policy you need to run Set-ExecutionPolicy RemoteSigned command.
Copy to Clipboard
Confirm changes by running commmand Get-ExecutionPolicy. You should see now that your policy is RemoteSigned now.
Copy to Clipboard
Leave A Comment