Windows 7 equivalent of "Add-WindowsFeature"

I'm wanting to script the "Turn Windows Features On or Off" functionality for my development group so that we'll have a means of ensuring that everyone is running on the same configurations. I know that you can do this in Win Server 2008, but in Windows 7 it appears that the "Add-WindowsFeature" cmdlet isn't available. I've also read that it is possible using DISM.exe, but I'm afraid to use this without any prior experience because it seems risky.

It doesn't necessarily have to be scripting. Windows Features is just one of serveral configurations that developers are responsible for modifying personally. It would also be nice to ensure (for example) that IIS and certain services are configured properly on a given developer's machine. If there's a larger scale tool that could give us this functionality, I would be interested in that too. I'm just hesitant of DISM because I don't know it and it seems to change the image files.


Solution 1:

List available features:

dism /Online /Get-Features

Enable feature:

dism /Online /Enable-Feature /FeatureName:featureA

Disable feature:

dism /Online /Disable-Feature /FeatureName:featureB

Using dism is no more/less risky that accessing appwiz.cpl as an administrator.

re-edit

Here's a script I've actually tried before posting. It will iterate available features and list their Feature Name as well as Display Name -- This is what appears in appwiz.cpl. I am still sure someone will post an elegant one-liner that puts this to shame:

@ECHO OFF
FOR /F "usebackq tokens=3,*" %%a in (`dism /Online /Get-Features ^| find /i "name"`) do (
    dism /Online /Get-FeatureInfo /FeatureName:"%%b" | find /i "name"
)

Solution 2:

DISM is what you're looking for. You use the /online option to target the running OS rather than an offline image. This is how you add and remove windows roles and features in Server Core.