Installing IIS 7 on Windows Vista and Windows 7 This must be familiar to most of the developer and deployment guys. And I admit that, this is still my favorite way to install IIS.
But today, in order to simplify the deployment process. I keep digging and found a useful way to do what we need.
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WebServerRole
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WebServer
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-CommonHttpFeatures
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpErrors
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpRedirect
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ApplicationDevelopment
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-NetFxExtensibility
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HealthAndDiagnostics
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpLogging
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-LoggingLibraries
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-RequestMonitor
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpTracing
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-Security
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-URLAuthorization
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-RequestFiltering
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-IPSecurity
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-Performance
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpCompressionDynamic
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WebServerManagementTools
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ManagementScriptingTools
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-IIS6ManagementCompatibility
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-Metabase
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HostableWebCore
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-StaticContent
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-DefaultDocument
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-DirectoryBrowsing
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WebDAV
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ISAPIExtensions
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ISAPIFilter
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ASPNET
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ASP
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-CGI
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ServerSideIncludes
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-CustomLogging
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-BasicAuthentication
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-HttpCompressionStatic
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ManagementConsole
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ManagementService
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WMICompatibility
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-LegacyScripts
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-LegacySnapIn
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-FTPServer
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-FTPSvc
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-FTPExtensibility
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-WindowsAuthentication
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-DigestAuthentication
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ClientCertificateMappingAuthentication
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-IISCertificateMappingAuthentication
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:IIS-ODBCLogging
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:NetFx3
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:WCF-HTTP-Activation
%windir%\system32\dism.exe /online /quiet /enable-feature /featurename:WCF-NonHTTP-Activation
This bunch of scripts doing the job now. Those features name are quite understandable. Simply save this to a batch (.bat) file and now the steps become
- Right click on the Install_IIS.bat.
- Select “Run as administrator”.
Ok, now it reduced few pages of our installation guide. In-fact, we make it even more “environment friendly” by keep scripting.
%windir%\system32\inetsrv\appcmd add apppool /name:"ASP.NET 2.0 Pool" /managedRuntimeVersion:v2.0 /managedPipelineMode:Integrated
%windir%\system32\inetsrv\appcmd add apppool /name:"ASP.NET 4.0 Pool" /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated
These scripts replace the steps needed to create the Application Pools.
netsh http add sslcert ipport=0.0.0.0:443 certstorename=MY certhash=1C14B3461348AD3CB270BEA7316963AEC5C2B6B4 appid={5a599f4f-02dc-4120-8646-74fcbc5b4827}
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites /+"[name='Default Web Site'].bindings.[protocol='https',bindingInformation='*:443:']" /commit:apphost
These scripts prepare us the HTTPS binding with the predefined cert.
Awesome! Computer is doing the job and we are looking for more scripting now.