Complete Transaction - PowerShell


Complete-Transaction finalizes a transaction, either committing or aborting it, depending on the condition of the transaction. This command is typically used in conjunction with Start-Transaction to manage data integrity during database operations.


Complete-Transaction [-Confirm] [-Force] [-PassThru] [-WhatIf]


  • -Confirm: Prompts for confirmation before completing the transaction.
  • -Force: Completes the transaction without prompting for confirmation.
  • -PassThru: Returns an object representing the Transaction object.
  • -WhatIf: Displays what would happen if you ran the command without actually completing the transaction.


Committing a Transaction

# Perform database operations..

Aborting a Transaction

# Error occurs during database operations...
Complete-Transaction -Force

Common Issues

  • Transaction not started: Ensure that a transaction has been started using Start-Transaction before attempting to complete it.
  • Transaction already completed: If the transaction has already been committed or aborted, it cannot be completed again.
  • Concurrency conflicts: If another session has modified the same data during the transaction, a concurrency conflict may occur, resulting in an error.


Complete-Transaction can be used in conjunction with the following commands:

  • Start-Transaction: Starts a transaction.
  • Get-Transaction: Gets information about a transaction.
  • Undo-Transaction: Aborts a transaction.