Delen via


AuthorizationManager.ShouldRun Method

Definition

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

protected public:
 virtual bool ShouldRun(System::Management::Automation::CommandInfo ^ commandInfo, System::Management::Automation::CommandOrigin origin, System::Management::Automation::Host::PSHost ^ host, [Runtime::InteropServices::Out] Exception ^ % reason);
protected internal virtual bool ShouldRun (System.Management.Automation.CommandInfo commandInfo, System.Management.Automation.CommandOrigin origin, System.Management.Automation.Host.PSHost host, out Exception reason);
abstract member ShouldRun : System.Management.Automation.CommandInfo * System.Management.Automation.CommandOrigin * System.Management.Automation.Host.PSHost * Exception -> bool
override this.ShouldRun : System.Management.Automation.CommandInfo * System.Management.Automation.CommandOrigin * System.Management.Automation.Host.PSHost * Exception -> bool
Protected Friend Overridable Function ShouldRun (commandInfo As CommandInfo, origin As CommandOrigin, host As PSHost, ByRef reason As Exception) As Boolean

Parameters

commandInfo
CommandInfo

Information about the command to be run.

origin
CommandOrigin

The origin of the command.

host
PSHost

The host running the command.

reason
Exception

The reason for preventing execution, if applicable.

Returns

True if the host should run the command. False otherwise.

Applies to