Get-ExecutionPolicy

Get the current execution policy for the shell.

Syntax
      Get-ExecutionPolicy [[-Scope] ExecutionPolicyScope]
         [-List] [CommonParameters]

Key
   -List
Get all execution policy values for the session listed in precedence order. By default gets only the effective execution policy. -Scope ExecutionPolicyScope
Get the execution policy in the specified scope. By default gets only the effective execution policy for the current session. Valid values:

MachinePolicy Set by a Group Policy for all users of the computer.
UserPolicy Set by a Group Policy for the current user of the computer.
Process Set for the current PowerShell process.
CurrentUser Set for the current user.
LocalMachine Set for all users of the computer.

The execution policy is determined by execution policies (set using Set-ExecutionPolicy) and the Group Policy settings for the PowerShell execution policy. The default value is "Restricted."

Examples

Get the current execution policy for the shell:

PS C:\> get-executionpolicy

Set a new user preference for the shell execution policy and then display the effective execution policy.
In this example, because there is no Group Policy setting, the user preference is the effective policy for the shell:

PS C:\> set-executionpolicy RemoteSigned
PS C:\> get-executionPolicy

#Run baby run baby run baby run, Baby run# ~ Sheryl Crow

Related PowerShell Cmdlets

Set-ExecutionPolicy - Change the execution policy (user preference).
Set-AuthenticodeSignature - Place a signature in a PowerShell script or other file.
about_signing.


 
Copyright © 1999-2024 SS64.com
Some rights reserved