Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AuthorizationManager Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Defines the base class for an authorization manager of a Runspace.

An authorization manager helps a host control and restrict the execution of commands. For each of the command types listed in the CommandTypes enumeration, the engine requests permission from the AuthorizationManager to run the command.

Extending this class requires that you override the ShouldRun method with the logic specific to your needs. The base class gives permission to run every command. The default Microsoft.PowerShell.PSAuthorizationManager provides a customized and much more complete authorization policy.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

System.Object
  System.Management.Automation.AuthorizationManager
    Microsoft.PowerShell.PSAuthorizationManager

public class AuthorizationManager

NameDescription
System_CAPS_pubmethodAuthorizationManager(String)

Creates an instance of authorization manager using specified shellID.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethodShouldRun(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.

System_CAPS_pubmethodToString()

(Inherited from Object.)

The authorization manager helps control the execution of commands for the runspace. The Windows PowerShell runtime requests permission from the authorization manager to run the command types defined by the CommandTypes enumeration. The default implementation of this class gives permission for the runspace to run all types of commands.

When deriving from this class to create your own authorization policy, be sure to do the following:

  • Override the ShouldRun method with the logic specific to your needs.

  • Whenever your authorization policy blocks a command, set the reason parameter of the ShouldRun method with an exception object that describes why the command was blocked.

The PSAuthorizationManager class defines the authorization manager provided by Windows PowerShell.

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: