Transactions
A transaction allows a set of changes to be grouped together and committed at the same time. Transactions are only supported under Windows PowerShell. This section briefly explores this feature with no expectation that it will return in more recent editions of PowerShell.
The Registry
provider supports transactions in Windows, 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 can be created using the Start-Transaction
command, then each subsequent command can use...