Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Start-Transaction

Start-Transaction - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Starts a transaction.

Start-Transaction [-Independent] [-RollbackPreference {Error | TerminatingError | Never}] [-Timeout <int>] [-Confir
m] [-WhatIf] [<CommonParameters>]

The Start-Transaction cmdlet starts a transaction, which is a series of commands that are managed as a unit. A tran
saction can be completed ("committed"), or it can be completely undone ("rolled back") so that any data changed by 
the transaction is restored to its original state. Because the commands in a transaction are managed as a unit, eit
her all commands are committed or all commands are rolled back. 

By default, transactions are rolled back automatically if any command in the transaction generates an error, but yo
u can use the RollbackPreference parameter to change this behavior.

The cmdlets used in a transaction must be designed to support transactions. Cmdlets that support transactions have 
a UseTransaction parameter. To perform transactions in a provider, the provider must support transactions. The Wind
ows PowerShell Registry provider in Windows Vista and later versions of Windows supports transactions. You can also
 use the Microsoft.PowerShell.Commands.Management.TransactedString class to include expressions in transactions on 
any version of Windows that supports Windows PowerShell. Other Windows PowerShell providers can also support transa

Only one transaction can be active at a time. If you start a new, independent transaction while a transaction is in
 progress (neither completed nor undone), the new transaction becomes the active transaction, and you must commit o
r roll back the new transaction before making any changes to the original transaction. 

The Start-Transaction cmdlet is one of a set of cmdlets that support the transactions feature in Windows PowerShell
. For more information, see about_Transactions.