Get-Execution Policy & Set-Execution Policy

Execution Policy Explanation PowerShell

Hi everyone, let’s talk a little bit really little =] about Execution Policy, to be more precise, just focus on 4 options that we have in the policy which are:

What do the following options mean?

Restricted
UnRestrigated
RemoteSign
AllSigned

When we are downloading any PowerShell script from Technet or any websites and then trying to run them,  we may encounter this error:

File C:\Common\Scripts\hello.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details:

Get-Execution Policy

Before, showing you how to change them I want you to introduce them and share some words:

Restricted:
This is mode comes as default, applied on operation system, we can’t run any scripts.

All sign:
Allow scripts to runs, as long as they are under the digital signature of certified company.

RemoteSigned:
Allowing scripts to run, but it’s required that all scripts you have been download will be signed, well, is there a doubt with TechNet scripts? probably there is. When you are running a local script, that script  already signed by your Windows (You can open the MMC and then go to Certificate and see PowerShell certificates)

On Windows server 2012 the default mode is “RemoteSigned“.

Unrestricted:
It is allowing you to run any script you want, In order to change your PowerShell mode on your Windows server or Windows 7, 10 you need to open PowerShell and run (from security prescriptive, not recommended)

Get-ExecutionPolicy ( just to know which mode I am)

And then change it using:
Set-ExecutionPolicy

Leave a Comment

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

In the news
Load More