Get the current (active) transaction.

      Get-Transaction [CommonParameters]

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Get-Transaction gets an object that represents the current transaction in the session.

This cmdlet never returns more than one object, because only one transaction is active at a time. If one or more independent transactions are started (using Start-Transaction -Independent), the most recently started transaction is active, and that will be returned by Get-Transaction.

When all active transactions have either been rolled back or committed, Get-Transaction shows the transaction that was most recently active in the session.


Show the properties and methods of the transaction object:

PS C:\> get-transaction | get-member

Show the property values of a transaction object for a transaction that has been committed:

PS C:\> cd hklm:\software
HKLM:\SOFTWARE> Start-Transaction
HKLM:\SOFTWARE> New-Item SS64 -UseTransaction
HKLM:\SOFTWARE> Complete-Transaction
HKLM:\SOFTWARE> Get-Transaction

“A single arrow is easily broken, but not ten in a bundle” - Japanese Proverb

Related PowerShell Commands:

Start-Transaction - Start a new transaction
- Commit the transaction
- Add a command or expression to the transaction
- Roll back a transaction

Copyright © 1999-2018
Some rights reserved