Allowing scripts to be run via PowerShell

Running scripts via Powershell is disable by default.  There is a key to note that you can run commands or cmdlets from the PowerShell console, just not scripts.  To enable this feature you can do one of two things, however one trumps the other:

Via PowerShell

Modify your ExecutionPolicy via the Set-Execution cmdlet

First run Get-ExecutionPolicy to see what level you are at.  By default, this setting is set to Restricted. 

To see what settings are available for you to set, you can type

Get-Help Set-ExecutionPolicy

This output shows that we have four options:  Restricted, AllSigned, RemoteSigned, and Unrestricted.

To set your ExecutionPolicy to Unrestricted (not recommended for production) you would enter:

Set-ExecutionPolicy Unrestricted

To validate you settings after running the Set-ExecutionPolicy, run:

Get-ExecutionPolicy

From the command above, your ExecutionPolicy is now set to Unrestricted.  You can now run any scripts you like, signed or unsigned. (Bet your administrator is happy to hear that!)

Now for the other method for setting this policy

Via Group Policy

Seeing how the first method would be a nightmare to manage, Microsoft has released the ADM files for PowerShell that allow you to configure this setting via Group Policy.  Any settings made via Group Policy will overwrite those set manually via the PowerShell Console. 

powershellADM 

You can download the PowerShell ADM here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • Simpy

0 Responses to “Allowing scripts to be run via PowerShell”


  1. No Comments