Elevating PowerShell Script Execution Permissions

Hi, This blog entry is one of first of the series on PowerShell Scripts. You will find in this blog how can you run the PowerShell Scripts from your PowerShell Command Prompt on Windows 7 or Windows server 2008 and above.

The script execution is by default is disabled by Microsoft to protect the environment against malicious scripts, but you can run the scripts from your trusted sources by elevating and enabling the scripts execution policy.

image

*Sorry for a bad quality picture here, please try opening the picture in new window to see the parts.

If you follow the snap shot as above and Run the power shell as an administrator you will get the following shell. Try checking the Execution Policy on your computer by running the following command

Get-ExcecutionPolicy

SNAGHTML589113b

In this case you are not allowed to run scripts on your machine and you will get the following error while executing any script

SNAGHTML6056631

Now this is the time to set the execution policy to the one you required to run the scripts. You have different options here as follows

Restricted – This is the default execution policy on installation. When this policy is in effect, script execution is disabled.

AllSigned – When the execution policy is AllSigned, scripts can be executed, but they must be Authenticode-signed before they will run.

RemoteSigned – RemoteSigned requires that all scripts that are downloaded from a remote location must be Authenticode-signed before they can be executed.

Unrestricted – When the execution policy is unrestricted, PowerShell will run any script. It will still prompt the user when it encounters a script that has been downloaded however, this is the least secure setting.

In Our case we are going to use RemoteSigned option and we will run the following command

Set-ExecutionPolicy RemoteSigned –Force

SNAGHTML6074aa5 

Now if we Run the same Script as before we will be able to do that as follows

image 

In the screen above the script just open a Balloon in the System tray. I will be sharing the script in my next post.

So, after performing the above steps now you can run the scripts in your power shell and exploit the feature of this excellent creation

Information on this Post is helpful, Please don’t forget to rate or comment.

Visit us on http://www.bytebeats.com

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