#1 18 Nov 2015 01:02

Registered: 18 Nov 2015
Posts: 1

Batch file for IIS features

I recently created a batch file to use for uninstalling and reinstalling all of the IIS features on a Windows 7 machine, instead of needing to do it through the GUI.  I am having some issues with it however.  When I use it to remove all of the IIS features, it seems to work great every time, but when I use it to enable them, it will only enable about 1/3 to 1/2 of the features.  Is there something I am doing wrong?  I have tried running the batch file as admin as well.  For the sake of space, I only listed 3 of the features I am using (I have almost 50 listed in my full script).

Second question- Does each feature need to be listed on it's own line, or can I list all of them in one command, separated by semi-colons or something?

@echo off

set /p answer=Select whether you would like to (d)isable or (e)nable IIS Features.
if /i {%ANSWER%}=={d} (goto :Disable)
if /i {%ANSWER%}=={e} (goto :Enable)

dism /online /disable-feature /featurename:IIS-WebServerRole
dism /online /disable-feature /featurename:IIS-WebServer
dism /online /disable-feature /featurename:IIS-CommonHttpFeatures

dism /online /enable-feature /featurename:IIS-WebServerRole
dism /online /enable-feature /featurename:IIS-WebServer
dism /online /enable-feature /featurename:IIS-CommonHttpFeatures


Board footer

Powered by FluxBB