Running scripts is disabled on this system

After a long time,I was thought of launching the powercli it end up with an error messsage

“. : 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”

From the error message it is clearly says the security exception need to added,as per KB

https://technet.microsoft.com/library/hh847748.aspx

somehow the execution policy of the user account get changed after Windows upgrade(update).

To resolve this issue need to change the execution policy.

PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> Get-ExecutionPolicy -List

Scope ExecutionPolicy
—– —————
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined

2.Set the execution policy for the current user

PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

3.Check the execution policy for the current user

PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> Get-ExecutionPolicy -List

Scope ExecutionPolicy
—– —————
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine Undefined

Now the Powercli load charm!!

Reference:

http://serverfault.com/questions/696689/cannot-set-powershell-executionpolicy-for-currentuser

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s