ICommandRuntime Interface

 

Updated: April 27, 2016

Applies To: Windows PowerShell

This interface is used when you are calling the Invoke to explicitly invoke a cmdlet from within another cmdlet. It provides a mechanism for overriding the behavior of the methods called by the cmdlet you are invoking, such as the ShouldProcess and WriteObject methods.

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

public interface ICommandRuntime

NameDescription
System_CAPS_pubpropertyCurrentPSTransaction

Gets the latest transaction started by running the Start-Transaction cmdlet. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyHost

Retrieves the host used by the cmdlet.

NameDescription
System_CAPS_pubmethodShouldContinue(String, String)

Confirms the current operation with the user by displaying a query that is provided by the cmdlet and returning an answer based on the user feedback.

System_CAPS_pubmethodShouldContinue(String, String, Boolean, Boolean)

Confirms the current operation with the user by displaying a query that is provided by the cmdlet, including yes-to-all and no-to-all options, and returning an answer based on the user feedback.

System_CAPS_pubmethodShouldProcess(String)

Requests confirmation with the user by displaying the name of the resource to be changed, provided by the cmdlet, and returning an answer based on the user feedback.

System_CAPS_pubmethodShouldProcess(String, String)

Requests confirmation with the user by displaying the name of the resource to be changed and the action to be taken, provided by the cmdlet, and returning an answer based on the user feedback.

System_CAPS_pubmethodShouldProcess(String, String, String)

Requests confirmation with the user by displaying the action to be taken, a query asking if the cmdlet should continue, a caption for the prompt, and returning an answer based on the user feedback.

System_CAPS_pubmethodShouldProcess(String, String, String, ShouldProcessReason)

Requests confirmation with the user by displaying the action to be taken, a query asking if the cmdlet should continue, a caption for the prompt, and returning an answer based on the user feedback and the reason why false is returned.

System_CAPS_pubmethodThrowTerminatingError(ErrorRecord)

Processes the error object passed when the cmdlet calls ThrowTerminatingError.

System_CAPS_pubmethodTransactionAvailable()

Determines if the Start-Transaction cmdlet has been called and that there is a Windows PowerShell transaction available that the cmdlet can participate in. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodWriteCommandDetail(String)

Writes cmdlet execution information to the execution log of the pipeline.

System_CAPS_pubmethodWriteDebug(String)

Writes a debug message that can be displayed.

System_CAPS_pubmethodWriteError(ErrorRecord)

Processes a nonterminating error.

System_CAPS_pubmethodWriteObject(Object)

Processes a single object written by the cmdlet to the output pipeline.

System_CAPS_pubmethodWriteObject(Object, Boolean)

Processes an object, enumerating it if needed, that was written by the cmdlet to the output pipeline.

System_CAPS_pubmethodWriteProgress(Int64, ProgressRecord)

Processes a progress message, provided by the cmdlet, and the name of the cmdlet.

System_CAPS_pubmethodWriteProgress(ProgressRecord)

Process a progress message, provided by the cmdlet, without the name of the cmdlet.

System_CAPS_pubmethodWriteVerbose(String)

Processes a verbose message provided by the cmdlet.

System_CAPS_pubmethodWriteWarning(String)

Processes a warning message that is supplied by the cmdlet.

All calls to the cmdlet APIs are routed through to an instance of this interface. When cmdlets are called directly from the command line or by a host application, the Windows PowerShell runtime uses the default implementation of the interface. When cmdlets are called from within another cmdlet, you can use the default implementation, or pass a custom implementation to the Cmdlet.Invoke method, allowing you to change the behavior of the methods called by the cmdlet you are invoking.

Return to top
Show: