Undo-Transaction

Roll back the active transaction.

Syntax
       Undo-Transaction [-Confirm] [-WhatIf] [CommonParameters]

Key
   -Confirm
       Prompt for confirmation before executing the command.

   -WhatIf
       Describe what would happen if you executed the command without actually executing it.

Undo-Transaction rolls back the active transaction. When a transaction is rolled back , the changes made by commands within the transaction are discarded and the data is restored to its original form.

If the transaction includes multiple subscribers, an Undo-Transaction command rolls back the entire transaction for all subscribers.

By default, transactions are rolled back automatically if any command in the transaction generates an error. However, transactions can be started with a different rollback preference and you can use this cmdlet to roll back the active transaction at any time.

Examples

Start a transaction and then roll it back (undo) so that no changes are made:

PS C:\> cd hkcu:\software
PS HKCU:\Software> start-transaction
PS HKCU:\Software> new-item SS64 -usetransaction
PS HKCU:\Software> undo-transaction

“That glittering hope is immemorial and beckons many men to their undoing” ~ Euripides

Related PowerShell Cmdlets

Start-Transaction - Start a new transaction.
Complete-Transaction
- Commit the transaction.
Get-Transaction - Get information about the active transaction.


 
Copyright © 1999-2024 SS64.com
Some rights reserved