Udostępnij za pośrednictwem


PSAuthorizationManager Class

Definition

Defines the authorization policy that controls the way scripts (and other command types) are handled by PowerShell. This authorization policy enforces one of four levels, as defined by the 'ExecutionPolicy' value in one of the following locations:

In priority-order (highest priority first,) these come from:

  • Machine-wide Group Policy HKLM\Software\Policies\Microsoft\Windows\PowerShell
  • Current-user Group Policy HKCU\Software\Policies\Microsoft\Windows\PowerShell.
  • Current session preference ENV:PSExecutionPolicyPreference
  • Current user machine preference HKEY_CURRENT_USER\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
  • Local machine preference HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell

Restricted - All .ps1 files are blocked. ps1xml files must be digitally signed, and by a trusted publisher. If you haven't made a trust decision on the publisher yet, prompting is done as in AllSigned mode. AllSigned - All .ps1 and .ps1xml files must be digitally signed. If signed and executed, PowerShell prompts to determine if files from the signing publisher should be run or not. RemoteSigned - Only .ps1 and .ps1xml files originating from the internet must be digitally signed. If remote, signed, and executed, PowerShell prompts to determine if files from the signing publisher should be run or not. This is the default setting. Unrestricted - No files must be signed. If a file originates from the internet, PowerShell provides a warning prompt to alert the user. To suppress this warning message, right-click on the file in File Explorer, select "Properties," and then "Unblock." Requires Shell. Bypass - No files must be signed, and internet origin is not verified.

public ref class PSAuthorizationManager sealed : System::Management::Automation::AuthorizationManager
public sealed class PSAuthorizationManager : System.Management.Automation.AuthorizationManager
type PSAuthorizationManager = class
    inherit AuthorizationManager
Public NotInheritable Class PSAuthorizationManager
Inherits AuthorizationManager
Inheritance
PSAuthorizationManager

Constructors

PSAuthorizationManager(String)

Initializes a new instance of the PSAuthorizationManager class, for a given ShellId.

Methods

ShouldRun(CommandInfo, CommandOrigin, PSHost, Exception)

Determines if the host should run the command a specified by the CommandInfo parameter. The default implementation gives permission to run every command.

(Inherited from AuthorizationManager)

Applies to