AuthorizationManager.ShouldRun Method

Determines whether a command should be run.


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

A CommandInfo object that describes the command to be run.

origin

A CommandOrigin object that describes the dispatch origin of the command.

host

A PSHost object that describes the host that provides communications between the Windows PowerShell runtime and the command line.

reason

If your authorization policy blocks the execution of a command, this parameter holds an Exception object that contains the reason why the command was blocked. When deriving from this class, be sure to populate this parameter with an exception describing the reason why your implementation blocked the execution of the command.

Return Value

True if the command should be run; otherwise, false is returned.

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

Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.
Show:
© 2014 Microsoft