AuthorizationManager.ShouldRun Method

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


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

'Usage
Dim commandInfo As CommandInfo
Dim origin As CommandOrigin
Dim host As PSHost
Dim reason As Exception
Dim returnValue As Boolean

returnValue = Me.ShouldRun(commandInfo, origin, host, reason)

protected internal virtual bool ShouldRun (
	CommandInfo commandInfo,
	CommandOrigin origin,
	PSHost host,
	out Exception reason
)
protected boolean ShouldRun (
	CommandInfo commandInfo, 
	CommandOrigin origin, 
	PSHost host, 
	/** @attribute OutAttribute() */ /** @ref */ Exception reason
)

Parameters

commandInfo

Information about the command to be run.

origin

The origin of the command.

host

The host running the command.

reason

The reason for preventing execution, if applicable

Return Value

True if the host should run the command. False otherwise

When deriving from this class to create your own authorization policy, override this method with the logic specific to your needs.


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

 

Target Platforms


Show:
© 2015 Microsoft