Unable to Run PowerShell Scripts on Windows PowerShell–“Execution of scripts is disabled on this system” Error Occurred.

Tried to execute a PowerShell script in one of my test server (windows server 2008 R2) and got an error saying Execution of scripts is disabled on this system.

Note : Basically this policy helps you to prevent untrusted scripts which can be affected to Production/critical environments. you may revert back to default once you done with your scripts if it is and critical server on production in order to prevent untrusted affections.

clip_image001

Running below line on PowerShell fixed the point and PowerShell was back to work.

  1. Set-ExecutionPolicy Unrestricted
  2. Type ‘Y’ and Enter to agree and proceed

clip_image002

Note : Run below line to revert back the policy setting to default.

Set-ExecutionPolicy Restricted

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