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.

Cmdlet.CurrentPSTransaction Property


Updated: April 27, 2016

Applies To: Windows PowerShell

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

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

public PSTransactionContext CurrentPSTransaction { get; }

Property Value

Type: System.Management.Automation.PSTransactionContext

A PSTransactionContext object that can be used to reset the current transaction.

Windows PowerShell transactions allow you to perform several actions as a group. If all the actions succeed, you can accept the transaction. If any one of the actions fail, you can roll back the transaction.

Transactions are started only when the Start-Transaction cmdlet is run. When started, the Complete-Transaction cmdlet can be run to accept the actions of the cmdlets that participated in the transaction, or the Undo-Transaction cmdlet can be run to roll back the actions made by those cmdlets. Not all cmdlets that are run between when the Start-Transaction cmdlet and the Complete-Transaction cmdlet or the Undo-Transaction cmdlet are called, will participate in the transaction. Only those cmdlets that have their RequiresTx parameter set to true can participate in the transaction.

Return to top

Community Additions