Last modified at 4/16/2014 8:12 PM by Koen Zomers

As of SharePoint 2013 Service Pack 1, SharePoint 2013 can be installed on Windows Server 2012 R2. Before this you were restricted to Windows Server 2012. When you want to install Workflow Manager which is used by SharePoint 2013 Workflows on a Windows Server 2012 R2 environment as well, you need to take specific steps to make this possible. These aren't necessarily logical and these are not well documented. The steps to install the Workflow Manager components and do the configuration for a SharePoint 2013 farm running on Windows Server 2012 R2 can be found below.

These steps assume installation on a server that is not connected to the internet and are written in a way that requires no user intervention, thus is perfectly suitable for further scripting.

  1. Download the web platform installer from http://www.microsoft.com/web/downloads/platform.aspx and install it on a machine with internet access and on the machine where you want to install Workflow Manager

  2. Run the below commands on the machine with internet access to download Service Bus, Workflow Client and Workflow Manager Refresh for offline installation (change the drive letter in case you don't have a D drive):

    Webpicmd /offline /Products:ServiceBus /Path:D:\ServiceBus

    Webpicmd /offline /Products:WorkflowClient /Path:D:\WorkflowClient

    Webpicmd /offline /Products:WorkflowManagerRefresh /Path:D:\WorkflowManagerRefresh

  3. On the machine with internet access, download the Cumulative Update for Service Bus 1.0 from: http://www.microsoft.com/en-us/download/details.aspx?id=36794

  4. Copy the three folders from step 2 and the file from step 3 to the D:\ drive on the server where you want to install Workflow Manager

  5. On the server where you want to install Workflow Manager, in a PowerShell window, run:

    Write-Host "- Installing Service Bus 1.0"

    Start-Process -FilePath "c:\Program Files\Microsoft\Web Platform Installer\WebpiCmd.exe" -ArgumentList "/Install /Products:ServiceBus /XML:d:\ServiceBus\feeds\latest\webproductlist.xml /AcceptEula /SuppressPostFinish" -Wait -PassThru | Out-Null


    Write-Host "  - Patching Service Bus 1.0 using Cumulative Update (KB2799752)"

    Start-Process -FilePath "d:\ServiceBus-KB2799752-x64-EN.exe" -ArgumentList "/passive" -Wait -PassThru | Out-Null


    Write-Host "- Installing Workflow Client"

    Start-Process -FilePath "c:\Program Files\Microsoft\Web Platform Installer\WebpiCmd.exe" -ArgumentList "/Install /Products:WorkflowClient /XML:d:\WorkflowClient\feeds\latest\webproductlist.xml /AcceptEula /SuppressPostFinish" -Wait -PassThru | Out-Null


    Write-Host "- Installing Workflow Manager Refresh"

    Start-Process -FilePath "c:\Program Files\Microsoft\Web Platform Installer\WebpiCmd.exe" -ArgumentList "/Install /Products:WorkflowManagerRefresh /XML:d:\WorkflowManagerRefresh\feeds\latest\webproductlist.xml /AcceptEula /SuppressPostFinish" -Wait -PassThru | Out-Null


  6. You can now use the PowerShell script below on the machine where you just installed the Workflow Manager components to configure Workflow to be used for SharePoint 2013.

    Make sure not to reuse the PowerShell window you used at the previous step as that doesn't have the WorfklowManager PowerShell module available yet. Instead just open a new normal PowerShell window and execute the below PowerShell script in it.

    The below script is just a sample. You need to change all the variables like the database names, usernames, passwords and such to suit your environment. So don't literally copy/paste and expect it to work!

# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed
Import-Module WorkflowManager

$sqlServer = "SPLTSQL"
Write-Host "Configuring the Workflow Manager and Service Bus" -ForegroundColor White

# Create new SB Farm
Write-Host "Creating new Service Bus Farm" -ForegroundColor White
$SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String "Pass@word1"

New-SBFarm -SBFarmDBConnectionString "Data Source=$sqlServer;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False" -InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount "contoso\administrator" -AdminGroup "BUILTIN\Administrators" -GatewayDBConnectionString "Data Source=$sqlServer;Initial Catalog=SbGatewayDatabase;Integrated Security=True;Encrypt=False" -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString "Data Source=$sqlServer;Initial Catalog=SBMessageContainer01;Integrated Security=True;Encrypt=False" | Out-Null

# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.
Write-Host "Creating new Workflow Farm" -ForegroundColor White

# Create new WF Farm
$WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String "Pass@word1"

New-WFFarm -WFFarmDBConnectionString "Data Source=$sqlServer;Initial Catalog=WFManagementDB;Integrated Security=True;Encrypt=False" -RunAsAccount "contoso\administrator" -AdminGroup "BUILTIN\Administrators" -HttpsPort 12290 -HttpPort 12291 -InstanceDBConnectionString "Data Source=$sqlServer;Initial Catalog=WFInstanceManagementDB;Integrated Security=True;Encrypt=False" -ResourceDBConnectionString "Data Source=$sqlServer;Initial Catalog=WFResourceManagementDB;Integrated Security=True;Encrypt=False" -CertificateAutoGenerationKey $WFCertAutoGenerationKey | Out-Null

Write-Host "Adding service bus host" -ForegroundColor White
# Add SB Host
$SBRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String "Pass@word1"

Add-SBHost -SBFarmDBConnectionString "Data Source=$sqlServer;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False" -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey | Out-Null

Try
{
    # Create new SB Namespace
    Write-Host "Creaing Service Bus namespace 'WorkflowDefaultNamespace' " -NoNewLine
    New-SBNamespace -Name "WorkflowDefaultNamespace" -AddressingScheme "Path" -ManageUsers "contoso\administrator","contoso\domain users" | Out-Null
   Write-Host "Succeeded"
   Start-Sleep -Seconds 90
}
Catch [system.InvalidOperationException]
{
                Write-Host "Failed"
}

# Get SB Client Configuration
$SBClientConfiguration = Get-SBClientConfiguration -Namespaces "WorkflowDefaultNamespace"
Write-Host "Adding workflow host" -ForegroundColor White

# Add WF Host
$WFRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String "Pass@word1"
Add-WFHost -WFFarmDBConnectionString "Data Source=$sqlServer;Initial Catalog=WFManagementDB;Integrated Security=True;Encrypt=False" -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -EnableHttpPort -CertificateAutoGenerationKey $WFCertAutoGenerationKey | Out-Null

Write-Host "Registering Workflow Manager with SharePoint farm " -ForegroundColor White
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
Start-Sleep -Seconds 15

# SPSite must be a site on your SharePoint farm that will not be removed and to which Workflow Manager will be linked
# WorkflowHostUri must contain your server name on which you just installed Workflow Manager
Register-SPWorkflowService -SPSite "https://workflow.contoso.local" -WorkflowHostUri "https://spltsp.contoso.local:12290" | Out-Null

# The following steps required to enabled workflow apps after march PU
Start-Sleep -Seconds 5
$wms = Get-SPWorkflowServiceApplicationProxy
$wms.RegisterWorkflowLifecycleManagementEnvironment()