Games: Beginner 5
This one involves setting some registry settings to increase the number of concurrent downloads. I’m running Windows 7 and IE 8 which have already increased the limits from 2 to 6. Tobias has done a really good job on his expert commentary - http://blogs.technet.com/heyscriptingguy/archive/2009/06/18/hey-scripting-guy-event-5-solutions-from-expert-commentators-beginner-and-advanced-the-400-meter-race.aspx - so rather than repeat that I’m going to use this as an example of using transactions in PowerShell v2.
Use Requires to restrict to PowerShell v2
use the registry provider to navigate to the location of the settings and use get-itemproperty to display the values
We can then start our transaction. Make the changes and display the properties again. Notice that we have to use the
-UseTransaction parameter to involve these cmdlets in the transaction. A Read-Host is used to pause the script. Check the values and we can seen that the properties have been added. Continue the script by pressing any key (if you can find it) and then the transaction will undo. Display the properties again to show that the change has been undone.
Transactions are only available on the Registry provider at the moment. Hopefully, they will be extended onto the other providers in the next version of PowerShell.