R – How to change features in Windows Vista programatically

powershellsystem-administrationwindows-vista

I'm looking for a way to programatically change features ("Programs and Features" -> "Turn Windows Features on or off") in Windows Vista (and newer Redmond OS, e.g. Server 2008).

Ideal solution would be in the form of a Powershell script (Get-Features, Set-Features), however any pointers to MSDN/other documentation would be very welcome! (my initial quick Google/StackOverflow search came up empty).

Having an automatic way to turn features on or off would allow me to automate computer setup for different scenarios. For example, to develop ASP.NET applications using IIS a bunch of IIS features need to be installed that are not installed by default. My current process of "make sure at least the features shown in this screenshot are checked" leaves a lot to be desired.

Best Answer

I just found an extension that works for Windows 7. "PowerShell module to Add/Remove Windows 7 features" - https://psclientmanager.codeplex.com/