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.
*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
In this case you are not allowed to run scripts on your machine and you will get the following error while executing any script
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
Now if we Run the same Script as before we will be able to do that as follows
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