CmdID / PowerShell / Cmdlets / Undo
Undo-Transaction
Rolls back the active transaction. PowerShell reference
From the PowerShell reference 2 parameters
What it does
Rolls back the active transaction. The Undo-Transaction cmdlet rolls back the active transaction. When you roll back a transaction, the changes that were made by the commands in 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 whole 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 by using a different rollback preference and you can use this cmdlet to roll back the active transaction at any time. The Undo-Transaction cmdlet is one of a set of cmdlets that support the transactions feature in Windows PowerShell. For more information, see about_Transactions.
Undo-Transaction [-WhatIf] [-Confirm] [<CommonParameters>]
Roll back the current transaction
Undo-TransactionIdentifyStart and roll back a transaction
Set-Location HKCU:\software
Start-Transaction
New-Item -Path "ContosoCompany" -UseTransaction
Undo-TransactionIdentifyRoll back a transaction for all subscribers
Set-Location HKCU:\software
Start-Transaction
New-Item -Path "ContosoCompany" -UseTransaction
Get-TransactionIdentifyIts page in the reference: Undo-Transaction.
Parameters
-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.