Wednesday, January 15, 2014

Installing SharePoint 2013 Prerequisites On Windows Server 2012 R2

As of right now, the SharePoint 2013 Prerequisite Installer is not supported on Windows 2012 R2.  Awesome.

So, here is a way to get around it, but not have to do anything manually.

You first need to ensure that you can run PowerShell scripts on your server.  Start a PowerShell session as an administrator and type:
Set-ExecutionPolicy unrestricted

You should know that this will disable all warnings for all PowerShell saved scripts.  You should be careful as to what you deploy on your server.  Buyer beware.

Now, download all of the prerequisite files:
SQL Server 2008 R2 SP1 Native Client
Microsoft WCF Data Services 5.0
Microsoft Information Protection and Control Client (MSIPC)
Microsoft Sync Framework Runtime v1.0 SP1 (x64)
Windows Identity Extensions
Windows Identity Foundation (KB974405)
Windows Server AppFabric
CU 1 for AppFabric 1.1 (KB2671763)

Put these in a folder, and remember where you put them.


Next you are going to create two PS1 files.  The first one will install the Windows Services that you need.  The second one will install the Microsoft requisite files.

The first script is fairly simple:
Import-Module ServerManager 

Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer –Source D:\sources\sxs
Write-Output "Windows features installed.  Computer will restart int 5 seconds."
Start-Sleep -seconds 5
Restart-Computer -Force

All this does is call the Add-WindowsFeature of the ServerManager module. Just run this guy as an administrator and you are good to go. You will need to restart after the installs... Well, maybe you don't, but I always like to. Anyway, at the end I warn the user that the server will restart in 5 seconds, then I restart it.

The next script uses a couple of different commands. The first command, Unblock-File gets rid of that annoying "Do you really want to run this file?" message that Windows likes so well. We just want to install we don't want to click anything.
The next command is Start-Process. Start-Process is a nifty cmdlet that allows you to enables you start a program, pass it arguement parameters, then tell PowerShell to just hang out until the process completes.

param([string] $SharePoint2013Path = $(Read-Host -Prompt "Please enter the directory path to where your SharePoint 2013 pre-req installation files exist.")) 
   
$CurrentLocation = $SharePoint2013Path
Unblock-File -Path $SharePoint2013Path\MicrosoftIdentityExtensions-64.msi
Start-Process -filepath $SharePoint2013Path\MicrosoftIdentityExtensions-64.msi -ArgumentList "/passive" -Wait
Unblock-File -Path $SharePoint2013Path\setup_msipc_x64.msi
Start-Process -filepath $SharePoint2013Path\setup_msipc_x64.msi -ArgumentList "/passive" -Wait
Unblock-File -Path $SharePoint2013Path\sqlncli.msi
Start-Process $SharePoint2013Path\sqlncli.msi  -ArgumentList "/passive IACCEPTSQLNCLILICENSETERMS=YES" -Wait
Unblock-File -Path $SharePoint2013Path\Synchronization.msi
Start-Process -filepath $SharePoint2013Path\Synchronization.msi -ArgumentList "/passive" -Wait
Unblock-File -Path $SharePoint2013Path\WcfDataServices.exe
Start-Process -filepath $SharePoint2013Path\WcfDataServices.exe -ArgumentList "/passive /norestart" -Wait -Verb RunAs
Unblock-File -Path $SharePoint2013Path\WindowsServerAppFabricSetup_x64.exe
Start-Process -filepath $SharePoint2013Path\WindowsServerAppFabricSetup_x64.exe -ArgumentList "/i CacheClient,CachingService,CacheAdmin /gac" -Wait -Verb RunAs
Unblock-File -Path $SharePoint2013Path\AppFabric1.1-RTM-KB2671763-x64-ENU.exe
Start-Process -filepath $SharePoint2013Path\AppFabric1.1-RTM-KB2671763-x64-ENU.exe -ArgumentList "/passive /norestart" -Wait -Verb RunAs
Write-Output "Complete.  Server will restart in 5 seconds"
Start-Sleep -Seconds 5
Restart-Computer -Force

So, what I do here is ask the user where the install files are, that should be the folder that you saved the prereqs that you downloaded earlier in, then runs the installs in the correct order, with the correct arguments. This is very important, especially with the App Fabric setup.
I then restart the server again. You might need it, you might not, I like to because it is a good idea after installing so much stuff, and before you are going to do the BIG install of SharePoint.

That's it! You can either run the manual install from here or run another kind of scripted install. Everything should work, unless the script tries to run the PrerequisiteInstaller.exe program...