Windows Server 2012 Core, SharePoint 2013 and NetApp SMx Adventures (Part 2)

Well I have finally taken the next step, installing all the Windows Features, as part of my Windows Server 2012 core setup for SharePoint 2013 and NetApp SMx products.

 

I wrote a simple PowerShell script on my main desktop, which is Windows Server 2012, then transferred over to the c:\temp directory on the Server Core machine to run. This script is meant to install all the required features for NetApp SnapManager for SharePoint (SMSP) as it needs IIS, ASP.NET, HTTP Activitation, etc. Other NetApp SMx products, SnapDrive for Windows and SnapManager for SQL Server, don't have the heavy Windows Roles/Feature requirements like SMSP.

 

My script is called Install-WindowsFeatures.ps1 and when run starts and completes as shown below. I had to run Set-ExecutionPolicy Unrestricted first to run the script.

I did not add the cmdlet to automatically but just tact on Restart-Computer to the script or type at the prompt and your system will restart.

 

Below is the PowerShell script, I use all the Write-Host so the header information is not overlaid by the progress indicator that you can see in the first screenshot above.

 

Import-Module ServerManager

function AddWindowsFeatures()

{

    Write-Host

    Write-Host

    Write-Host

    Write-Host

    Write-Host

    Write-Host

    Write-Host "==============================================================================="

    Write-Host " NetApp Automation Script"

    Write-Host "==============================================================================="

    Write-Host

    Write-Host " Install the required Windows Server features to support SnapManager for "

    Write-Host " SharePoint. This will take several minutes, please be patient."

    Write-Host

    Write-Host " NOTE: A warning will be displayed if Windows automatic updates is not enabled."

    Write-Host "==============================================================================="

    

    $ReturnCode = 0  

    $WindowsFeatures = @(

                     "NET-Framework-Features",

                     "NET-Framework-Core",

                     "NET-Non-HTTP-Activ",

                     "Web-Server",

                     "NET-HTTP-Activation",

                     "WAS",

                     "WAS-Process-Model",

                     "WAS-NET-Environment",

                     "WAS-Config-APIs",

                     "Web-Common-Http",

                     "Web-Default-Doc",

                     "Web-Dir-Browsing",

                     "Web-Http-Errors",

                     "Web-Static-Content",

                     "Web-Health",

                     "Web-Http-Logging",

                     "Web-Log-Libraries",

                     "Web-Request-Monitor",

                     "Web-Http-Tracing",

                     "Web-Custom-Logging",

                     "Web-Security",

                     "Web-Filtering",

                     "Web-App-Dev",

                     "Web-Asp-Net",

                     "Web-Net-Ext",

                     "Web-ISAPI-Ext",

                     "Web-ISAPI-Filter",

                     "Web-Mgmt-Tools",

                     "Web-Mgmt-Console",

                     "Web-Mgmt-Compat",

                     "Web-Metabase"

                     "Web-Performance",

                     "Web-Stat-Compression"

    )

    Try {

        $myCommand = 'Add-WindowsFeature ' + [string]::join(",",$WindowsFeatures)

        Invoke-Expression $myCommand

        Write-Host               

        Write-Host " Completed: All Windows Server features have been installed."

    }

    Catch {

        $ReturnCode = -1

                 Write-Warning " An error was encountered while adding Windows Server features. Please refer

to the error below and re-run the script or add the Windows Server features manually using

Server Manager."

        Write-Error $_

        break

    }

    return $ReturnCode 

}

 

function InstallFeaturesAndPreReqs()

{

    $rc = 0

    if($rc -ne -1) {

        $rc = AddWindowsFeatures

    }

    

    if($rc -ne -1) {

        Write-Host

        Write-Host "================================================================"

        Write-Host " Windows Server features sucessfully installed!"

        Write-Host

    }

}

 

InstallFeaturesAndPreReqs

 

Look for Part 3 soon on installing Microsoft SQL Server 2012 and Microsoft SharePoint Server 2013.

 

Have a great weekend!

Barkz