CmdID

CmdID / PowerShell / Cmdlets / Use

Use-Transaction

Adds the script block to the active transaction. PowerShell reference

From the PowerShell reference 2 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Adds the script block to the active transaction. The Use-Transaction cmdlet adds a script block to an active transaction. This enables you to do transacted scripting by using transaction-enabled Microsoft .NET Framework objects. The script block can contain only transaction-enabled .NET Framework objects, such as instances of the Microsoft.PowerShell.Commands.Management.TransactedString class. The UseTransaction parameter, which is optional for most cmdlets, is required when you use this cmdlet. Use-Transaction is one of a set of cmdlets that support the transactions feature in Windows PowerShell. For more information, see about_Transactions.

Use-Transaction [-TransactedScript] <ScriptBlock> [-UseTransaction] [<CommonParameters>]

Script by using a transaction-enabled object

Start-Transaction $transactedString = New-Object Microsoft.PowerShell.Commands.Management.TransactedString $transactedString.Append("Hello") Use-Transaction -TransactedScript { $transactedString.Append(", World") } -UseTransaction $transactedString.ToString()Identify

Roll back a transaction

Start-Transaction $transactedString = New-Object Microsoft.PowerShell.Commands.Management.TransactedString $transactedString.Append("Hello") Use-Transaction -TransactedScript { $transactedString.Append(", World") } -UseTransaction Undo-Transaction $transactedString.ToString()Identify

Its page in the reference: Use-Transaction.

Parameters

2 in the PowerShell reference
-TransactedScriptSpecifies the script block that is run in the transaction. Enter any valid script block enclosed in braces ({}). This parameter is required.
-UseTransactionIncludes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_Transactions.