Partager via


ExecutionPolicy with Powershell

PowerShell icon

By default and for obvious security reasons the default execution policy of Powershell scripts is “Restricted”.

With this kind of mode you can run individual cmdlets but not saved Powershell scripts.

If you want to change this policy, you can run the following command:

Set-ExecutionPolicy <PolicyMode>

Here below the different <PolicyMode>  you can define:

  • Restricted: individual cmdlets but not saved scripts
  • AllSigned: you can run your scripts but you need digital signature
  • RemoteSigned: scripts which are written locally can run normally but any script from outside (web…) must have a digital signature
  • Unrestricted: ideal mode for development environment, you can execute every script – be careful with sensible environments Smile

image

Important: do not forget to run as Administrator your powershell console with Vista,7/2008/2008R2….because of UAC restrictions as this command modifies the registry and ExecutionPolicy is stored in the HKLM registry hive.

Vincent