Showing posts with label set-executionpolicy remotesigned. Show all posts
Showing posts with label set-executionpolicy remotesigned. Show all posts

Tuesday 5 July 2016

vSphere CLI error “PowerCLIEnvironment.ps1 cannot be loaded because running scripts is disabled on this system”.

Issue Description: I have just inatlled vSphere POwerCLI on a newly formated Windows10 machine. When I opened the POwerCLI for the first use, I noticed this error.

Error message in detail:
------------------------------------------------------------------------------------------------------------------------------
. : File C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.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.
At line:1 char:3
+ . "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scri ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

PS C:\Windows\system32>
-------------------------------------------------------------------------------------------------------------------------------
Error Screenshot:














Solution (Steps):
1. Open vSphere PowerCLI as Administrator























2. Run below command and Choose “Y
--------------------------------------------------
set-executionpolicy unrestricted
--------------------------------------------------- 












3. Now close the POwerCLI windows and run it again, the issue should go away.