Commit the active transaction. All commands in the transaction are finalized and the data affected by the commands is changed.

      Complete-Transaction [-Confirm] [-WhatIf] [CommonParameters]

       Prompt for confirmation before executing the command.

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

If the transaction includes multiple subscribers, to commit the transaction, you must enter one Complete-Transaction command for every Start-Transaction command.


Adding a new registry key:

PS C:\> cd hkcu:\software
PS HKCU:\software> Start-Transaction
PS HKCU:\software> New-Item SS64 -UseTransaction

PS HKCU:\software> Get-ChildItem SS*

^ returns nothing as it is not part of the transaction

PS HKCU:\software> Get-ChildItem SS* -UseTransaction
^ displays the new key

PS HKCU:\software> Complete-Transaction

“With the greater part of rich people, the chief enjoyment of riches consists in the parade of riches” ~ Adam Smith

Related PowerShell Cmdlets

Start-Transaction - Start a new transaction.
Complete-Transaction - Complete a transaction.
Get-Transaction - Get information about the active transaction.
- Add a command or expression to the transaction.
- Roll back a transaction.

Copyright © 1999-2024
Some rights reserved