Adding required Windows features when installing Sitecore 8

Recently I started working with Sitecore 8. One of the things I found out when installing Sitecore on Windows Server 2012 R2 is that it needs a few Windows roles and features as a prerequisite. Finding out which of these Windows roles & features are needed was is quite a challenge. So, to make things easier, I created a PowerShell script which installs all the required Windows roles and features.

The Install-WindowsFeature cmdlet

The Install-WindowsFeature cmdlet installs the specified roles, role services, and features on a computer that is running Windows Server 2012 R2, or on an offline virtual hard disk (VHD) on which Windows Server 2012 R2 is installed. This cmdlet works similarly to the Add Roles and Features Wizard in Server Manager, with an important exception: the cmdlet does not install management tools for roles, role services, and features by default. To install management tools such as snap-ins on a target server, you must add the IncludeManagementTools parameter to your command.

This cmdlet requires elevation; you must be running a Windows PowerShell session as an administrator to use this cmdlet.

In the documentation it is stated that when using the -Name<Feature[]> parameter, multiple features can be installed at the same time. For me it worked just without the name parameter. The script would look like this:

Install-WindowsFeature Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-DAV-Publishing,Web-Health,Web-Http-Logging,Web-Custom-Logging,Web-Log-Libraries,Web-ODBC-Logging,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-Net-Ext,Web-Net-Ext45,Web-Asp-Net,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Console,NET-Framework-Features,NET-Framework-Core,NET-Framework-45-Features,NET-Framework-45-Core,NET-Framework-45-ASPNET,NET-WCF-Services45,NET-WCF-TCP-PortSharing45


My colleague Albert-Jan Schot advised me add a little bit more user-friendliness to the code. I rewrote the script so now it first verifies if the feature is already installed. If not, it will prompt the user to install the required feature. Below is the updated script:


Import-Module ServerManager

$requiredFeatures = "Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-DAV-Publishing,Web-Health,Web-Http-Logging,Web-Custom-Logging,Web-Log-Libraries,Web-ODBC-Logging,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-Net-Ext,Web-Net-Ext45,Web-Asp-Net,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Console,NET-Framework-Features,NET-Framework-Core,NET-Framework-45-Features,NET-Framework-45-Core,NET-Framework-45-ASPNET,NET-WCF-Services45,NET-WCF-TCP-PortSharing45"
$title = "Install Windows Feature"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)

Foreach ($requiredFeature in $requiredFeatures.Split(",")) {
    # check whether or not the feature is installed
    $feature = Get-WindowsFeature $requiredFeature
    if( $feature.Installed -eq "True" ) {
        Write-Host "Windows $($feature.FeatureType) '$($feature.DisplayName)' is already installed"
    else {
        $message = "Do you want to add the required Windows $($feature.FeatureType) '$($feature.DisplayName)' to the system?"
        $result = $host.ui.PromptForChoice($title, $message, $options, 0)
        switch ($result)
            0 {
                Install-WindowsFeature $feature.Name
            1 {
            Write-Host -F red "Windows $($feature.FeatureType) '$($feature.DisplayName)' was not installed."}


Installing Sitecore 8 is actually quite easy. Before an instance of Sitecore 8 can be installed a few Windows roles and features are required. Using the Powershell command ‘Install-WindowsFeature’ all required roles and features will be installed.



Leave a Reply

Your email address will not be published. Required fields are marked *