PowerShell: Enable Script Support

By default, PowerShell has scripting support disabled. If you try and run a PowerShell script, you will be greeted with an error stating that the execution of scripts is disabled on your system. To enable scripting support so that your scripts will run, read on:


1. Open PowerShell (if you are running PowerShell on Windows Vista, right-click your PowerShell icon and select Run as administrator. If you don’t do this, you will not be able to enable script support).

2. Check the current script execution policy by using the Get-ExecutionPolicy cmdlet. To do this, input Get-ExecutionPolicy and press Enter on your keyboard. PowerShell will return a value of Restricted.

3. To change the script execution policy, use the Set-ExecutionPolicy cmdlet. Input Set-ExecutionPolicy unrestricted and press Enter on your keyboard.

4. To ensure that the script execution policy has been changed, use the Get-ExecutionPolicy cmdlet again. PowerShell should return a value of Unrestricted.

You can now run your PowerShell scripts.

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.

8 Responses to “PowerShell: Enable Script Support”

  1. December 23, 2008 at 11:30 am, Steve said:

    This doesn’t seem to work on XP — I fired up the new install of CTP3 and got my start-up script denied. Set-Ex ran but told me it was being overriden; running the PoSh executable as the local Admin let Set-Ex complete without any messages, but did not propagate the effect to my normal ID. I ended up searching the registry for the string “AllSigned” and changing my HKCU execution policy key manually.

    Reply

  2. March 17, 2009 at 4:24 pm, Guest said:

    Worked like a charm on XP for me.

    Reply

  3. May 01, 2009 at 7:28 pm, JWashington said:

    I have a XP system and this worked great thank you

    Reply

  4. February 15, 2010 at 3:35 pm, Jim Balcomb said:

    As a discussion point, `Set-ExecutionPolicy RemoteSigned` will let you run your scripts as well but leaves just a bit more security in place.

    Reply

  5. June 30, 2010 at 8:29 am, zwinnetetten said:

    arseholio

    Reply

  6. January 11, 2011 at 10:40 am, Wasim21k said:

    worked for me on Server 2008 R2 Standard

    Reply

    • January 22, 2011 at 8:34 pm, Glincb said:

      Worked GREAT on win7

      Reply

  7. April 30, 2013 at 8:25 am, Kareem Arafa said:

    Thanks a lot, Great work. I really needed that!!

    Reply

Leave a Reply