How To Allow The Execution Of PowerShell Scripts On Windows 7

If you are looking towards running your own scripts on Windows 7, it is vital for you to enable the execution of the PowerShell scripts, which is disabled by default. In case you attempt to run a script that has been downloaded from the World Wide Web without enabling PowerShell, you will have to face a cruel error message in red on Windows 7.

This is probably because the Windows PowerShell Modules present in Administrative Tools are also disabled by default. Now, this is quite daunting, but you can easily get rid of this error by allowing the execution of the PowerShell scripts.

How To Allow The Execution Of PowerShell Scripts On Windows 7

Photo Credit: Tutorialsplus.net/how-to-allow-the-execution-of-powershell-scripts-on-windows-7/

For all those who are great fans of this task automation shell featuring a command-line scripting language and the .NET Framework to carry out the directorial tasks on remote and local Windows systems, read ahead to know how to enable the execution of PowerShell scripts on a machine running Windows 7.

Recognizing the Different Execution Modes of PowerShell

Before you go ahead and enable the PowerShell functionality, it is necessary for you to know about its four different modes. This will give you an insight as to which mode can run which kind of script/code.

The first mode is the Restricted mode that prohibits the execution of scripts but supports interactive commands. By the way, this is the default mode of PowerShell. Second is the All Signed mode that allows running scripts and managing configuration files, both of which must be signed by a reliable publisher.

So, there is a possibility of running a signed, nasty script in case the publisher is not trustworthy. Third is the Remote Signed mode via which a local script is allowed to run without the digital signature, but the downloaded one needs to have a digital signature for execution.

Lastly, the Unrestricted mode, as the name suggests, allows the execution of all scripts as well as configuration files that are downloaded from interactive applications such as IE, MS Outlook, and Windows Messenger. Because there is no need of a digital signature, this mode again has the risk of running not only unsigned but also wicked scripts that you tend to download from these communication apps.

Identifying the Best PowerShell Mode for Running Scripts

The default mode of PowerShell runs as an interactive shell wherein it only loads signed configuration files from the trustworthy publishers. In case you are getting that red error, know that you are making an attempt to run an unsigned script in this mode. So, the best idea is to change the mode to unrestricted, run your downloaded script, and then switch quickly to the restricted (default) mode, as it is the safest mode to keep.

Working with the Best PowerShell Mode

Listed are the steps to change the default PowerShell mode, run the desired scripts, and then to switch to the default mode.

1. Select Orb (Start button) –> All Programs –> Accessories.
2. Right-click Windows PowerShell and select the Run as administrator option. The UAC box appears.
3. Click Yes. The administrative PowerShell command prompt appears.
4. Enter Set-ExecutionPolicy Unrestricted in the command prompt. A message appears confirming as to whether you are sure to change the Execution Policy.

Enable Execution Of PowerShell Scripts On Windows 7

5. Press Enter.
6. Run the downloaded scripts.
7. After running all the scripts, enter Set-ExecutionPolicy Restricted to switch back to the default mode again for ensuring security. A confirming message again appears.
8. Press Enter.



Dipaligandhi