Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2? [Answered]RSS

7 replies

Last post Mar 29, 2016 10:16 PM by agoktas

  • Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 22, 2016 09:24 PM|agoktas|LINK

    Hello, 

    Based on what I found here:  

    https://peter.hahndorf.eu/blog/WindowsFeatureViaCmd.html

    Is there a reason why I would want to use one script installation method over the other?  

    Enable-WindowsOptionalFeature vs Add-WindowsFeature vs dism.exe vs pkgmgr.exe??? 

    I made the mistake in 2008 when I started using servermanagercmd.exe and it became deprecated the same year.  Ugh.  I don't want to do the same thing again.  I want to stick with one that is expected to stick around for the long haul. 

    Thanks!

  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 23, 2016 02:01 AM|Jean Sun|LINK

    Hi,

    To install IIS 8.5 with a script, type the following on one line in an elevated command prompt.

    DISM.EXE /enable-feature /online /featureName:IIS-WebServerRole /featureName:IIS-WebServer 
    /featureName:IIS-CommonHttpFeatures /featureName:IIS-StaticContent /featureName:IIS-DefaultDocument 
    /featureName:IIS-DirectoryBrowsing /featureName:IIS-HttpErrors /featureName:IIS-HttpRedirect 
    /featureName:IIS-ApplicationDevelopment /featureName:IIS-ASPNET /featureName:IIS-NetFxExtensibility 
    /featureName:IIS-ASPNET45 /featureName:IIS-NetFxExtensibility45 /featureName:IIS-ASP /featureName:IIS-CGI 
    /featureName:IIS-ISAPIExtensions /featureName:IIS-ISAPIFilter /featureName:IIS-ServerSideIncludes 
    /featureName:IIS-HealthAndDiagnostics /featureName:IIS-HttpLogging /featureName:IIS-LoggingLibraries 
    /featureName:IIS-RequestMonitor /featureName:IIS-HttpTracing /featureName:IIS-CustomLogging 
    /featureName:IIS-ODBCLogging /featureName:IIS-Security /featureName:IIS-BasicAuthentication 
    /featureName:IIS-WindowsAuthentication /featureName:IIS-DigestAuthentication 
    /featureName:IIS-ClientCertificateMappingAuthentication /featureName:IIS-IISCertificateMappingAuthentication 
    /featureName:IIS-URLAuthorization /featureName:IIS-RequestFiltering /featureName:IIS-IPSecurity 
    /featureName:IIS-Performance /featureName:IIS-HttpCompressionStatic /featureName:IIS-HttpCompressionDynamic 
    /featureName:IIS-WebDAV /featureName:IIS-WebServerManagementTools /featureName:IIS-ManagementScriptingTools 
    /featureName:IIS-ManagementService /featureName:IIS-IIS6ManagementCompatibility /featureName:IIS-Metabase 
    /featureName:IIS-WMICompatibility /featureName:IIS-LegacyScripts /featureName:IIS-FTPServer /featureName:IIS-FTPSvc 
    /featureName:IIS-FTPExtensibility /featureName:NetFx4Extended-ASPNET45 /featureName:IIS-ApplicationInit 
    /featureName:IIS-WebSockets /featureName:IIS-CertProvider /featureName:IIS-ManagementConsole /featureName:IIS-LegacySnapIn

    Install IIS 8.5 using PowerShell

    You can use the following PowerShell cmdlets to install all of IIS 8.5:

    import-module servermanager
    add-windowsfeature web-server -includeallsubfeature

    To install only specific features, list them in the PowerShell cmdlet, as in the following example:

    import-module servermanager
    add-windowsfeature Web-Server, Web-WebServer, Web-Security, 
    Web-Filtering

    You can find more information about this in the following link.

    http://www.iis.net/learn/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 23, 2016 03:51 PM|agoktas|LINK

    Hey Jean, 

    Thank you for the reply, but please see my question again.  

    My question is specific to the recommended method (or preferred) to use.  One that will not be deprecated within a year or two as servermanagercmd.exe was in the past (just as an example).  

    Thanks.  

  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 24, 2016 07:20 AM|Jean Sun|LINK

    Hi,

    These methods I posted above was recommended in the MS official guide.

    http://www.iis.net/learn/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 24, 2016 05:59 PM|agoktas|LINK

    That url simply provides the different options.  

    I'm looking for someone's suggestion on which would be the best option.  

    Jean, 

    If you were to install IIS 8.5, which of the installation options would you use?  And why would you choose that option over the others?  Please provide your opinion if you don't mind.  :) 

    Thanks. 

  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 28, 2016 08:36 AM|Jean Sun|LINK

    Hi,

    I've installed serval versions of IIS(7,8,10). I prefer installing IIS using the UI.

    By this way, I can clearly see these feature that I've installed and features that are not installed. And this way is simple and user friendly.

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 29, 2016 10:15 PM|agoktas|LINK

    Based on the topic, we're only referring to scripted options.  

    I ended up using Add-WindowFeature because we all know PowerShell cmdlets aren't going anywhere and will continue to grow with each PowerShell version; so that is my recommendation for anyone that will scrip the install.  

    Here is an example of what I did:  

    # --------------------------------------------------------------------
    # Checking Execution Policy
    # --------------------------------------------------------------------
    $Policy = "Unrestricted"
    If ((get-ExecutionPolicy) -ne $Policy) {
    Write-Host "Script Execution is disabled. Enabling it now"
    Set-ExecutionPolicy $Policy -Force
    Write-Host "Please Re-Run this script in a new powershell enviroment"
    Exit
    }

    # --------------------------------------------------------------------
    # Run IIS 8.5 Installation on Windows Server 2012R2
    # --------------------------------------------------------------------
    <#
    ---One-liner samples---
    Here is a sample if you needed features on one line:
    $Features='Web-Server,Web-WebServer,Web-Common-Http'.Split(',')
    or
    $Features='Web-Server','Web-WebServer','Web-Common-Http'

    ---$Features---
    The purpose of the $Features variable below is to structure the installation features in a
    hierarchial order to help cross reference options when executing Get-WindowsFeature.
    #>

    $OutputRootDir = '\\server\Completed-Installations'
    $Hostname = hostname
    $OutputDir = $OutputRootDir + '\' + $Hostname
    $TranscriptOutputFile = 'Transcript_Output.txt'
    $InstallOutputFile = 'Add-WindowsFeature_InstallOutput.txt'
    $URLRewriteOutputFile = 'URLRewrite_InstallOutput.txt'
    $DescriptionOutputFile = 'Get-WindowsFeature_InstalledIIS85FeatureDetail.txt'
    $Features = @(
    'Web-Server',
    'Web-WebServer',
    'Web-Common-Http',
    'Web-Default-Doc',
    'Web-Dir-Browsing',
    'Web-Http-Errors',
    'Web-Static-Content',
    'Web-Http-Redirect',
    'Web-Health',
    'Web-Http-Logging',
    'Web-Log-Libraries',
    'Web-Request-Monitor',
    'Web-Http-Tracing',
    'Web-Performance',
    'Web-Stat-Compression',
    'Web-Dyn-Compression',
    'Web-Security',
    'Web-Filtering',
    'Web-Basic-Auth',
    'Web-CertProvider',
    'Web-Client-Auth',
    'Web-Digest-Auth',
    'Web-Cert-Auth',
    'Web-IP-Security',
    'Web-Url-Auth',
    'Web-Windows-Auth',
    'Web-App-Dev',
    'Web-ISAPI-Ext',
    'Web-ISAPI-Filter',
    'Web-WebSockets',
    'Web-Mgmt-Tools',
    'Web-Mgmt-Console',
    'Web-Scripting-Tools',
    'Web-Mgmt-Service'
    )

    if (!(Test-Path ($OutputRootDir + '\' + $Hostname))) {
    New-Item -Path ($OutputRootDir + '\' + $Hostname) -ItemType Directory
    Start-Transcript -Path ($OutputDir + '\' + $TranscriptOutputFile)
    }
    else {
    Write-Host "Your output directory already exists"
    Start-Transcript -Path ($OutputDir + '\' + $TranscriptOutputFile) -Append
    }

    Add-WindowsFeature $Features | select -expand FeatureResult | Format-Table -Property * -AutoSize | Out-File ($OutputDir + '\' + $InstallOutputFile)

    Get-WindowsFeature $Features | Format-Table -Wrap -AutoSize Name,Description | Out-File ($OutputDir + '\' + $DescriptionOutputFile)

    msiexec.exe /i \\home\depot\apps\ms.urlrewrite\rewrite_2.0_rtw_x64.msi /quiet /norestart /l* ($OutputDir + '\' + $URLRewriteOutputFile)

    Write-Host 'Your installation is now complete.
    The following output file contains your installed features descriptions:
    '$OutputDir'\'$DescriptionOutputFile'' -foregroundcolor green

    <#
    IIS installation defaults (if you were to only run : Add-WindowsFeature Web-Server)

    Web-Server,#Default`
    Web-WebServer,#Default`
    Web-Common-Http,#Default`
    Web-Default-Doc,#Default`
    Web-Dir-Browsing,#Default`
    Web-Http-Errors,#Default`
    Web-Static-Content,#Default`
    Web-Health,#Default`
    Web-Http-Logging,#Default`
    Web-Performance,#Default`
    Web-Stat-Compression,#Default`
    Web-Security,#Default`
    Web-Filtering,#Default`
    #>

    Stop-Transcript

    pause

  • Re: Which is the recommended method to install IIS 8.5 on Windows Server 2012 R2?

    Mar 29, 2016 10:16 PM|agoktas|LINK

    The main part to take away from this is $Features & the line with Add-WindowsFeature.