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.
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

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> dir SS*

^ returns nothing as it is not part of the transaction

PS HKCU:\software> dir 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 Commands:

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

Copyright © 1999-2019
Some rights reserved