Get-Transaction

Get the current (active) transaction.

Syntax
      Get-Transaction [CommonParameters]

Key

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.

Example

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 Cmdlets:

Start-Transaction - Start a new transaction.
Complete-Transaction
- Commit the transaction.
Use-Transaction
- Add a command or expression to the transaction.
Undo-Transaction
- Roll back a transaction.


 
Copyright © 1999-2021 SS64.com
Some rights reserved