A transaction allows a set of changes to be grouped together and committed at the same time. Transactions are only supported under Windows PowerShell.
The registry provider supports transactions, as shown in the following code:
PS> Get-PSProvider
Name Capabilities Drives
---- ------------ ------
Registry ShouldProcess, Transactions {HKLM, HKCU}
Alias ShouldProcess {Alias}
Environment ShouldProcess {Env}
FileSystem Filter, ShouldProcess, Credentials {B, C, D}
Function ShouldProcess {Function}
Variable ShouldProcess {Variable}
A transaction may be created as follows:
Start-Transaction $path = 'HKCU:\TestTransaction' New-Item $path -ItemType Key...