Complete-Transaction

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

Syntax
      Complete-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 the command.
 
   CommonParameters:
       -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.

Example

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:

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


© Copyright SS64.com 1999-2013
Some rights reserved