Iron Scripter prelude

Iron Scripter Prelude 1 Solutions

So you had a little bit of time to work out a solution the first prelude challenge. Even though you might be tempted to answer all solutions as a script, sometimes you just need a command or two that will run successfully at a console prompt. Once you have the essential PowerShell commands working, then you can build a script or function around it. For the first prelude challenge most of you (hopefully) figured out a way to use the WindowsFeature cmdlets and Compare-Object. The Chairman has collected some code samples that are more or less representative of the different factions.


For clarity it might help to define variables for the source and target servers.

Using Get-WindowsFeature for the source computer would seem the obvious step. But here is more elegant approach.

The challenge is to install features that are installed but missing on the target and remove features installed on the target not installed on the source. By grouping the features based on their installed property as a hashtable, it is easier to reference features.

Windows Features as a hashtable

You can use the hashtable to install missing features.

Installing missing Windows features

And likewise to remove features that shouldn’t be installed.

Removing unwanted Windows Features


The Battle faction might take a more direct approach.

Brutal but it gets the job done.


The Flawless faction will invest a bit more time and might come up with a re-usable function like this:

The Flawless function in action

The Chairman hopes you find the sample solutions informative. Of course there are other ways to achieve the desired result for each faction. Hopefully you are sharing those results with your faction-mates.

Stay tuned for another Iron Scripter prelude challenge.

2 thoughts on “Iron Scripter Prelude 1 Solutions”

  1. Hi Jeff, I’ve decided to use the dism way directly on my side, not sure that it was a good choice but it works lol. Quick comment on your code, I think you forgot a -credential in your end block. Pretty nice code as usual btw ;).

Comments are closed.