There is often a hassle installing and configuring the Workflow Manager for SharePoint 2013. If you plan on doing this scripted, the hassle grows. However, with the below script, installation of Workflow Manager becomes much easier and can be done automated.

To give a bit of a background on the above statements, the points have been broken into bullets.

  • Workflow Manager is a separate product from SharePoint 2013, however with a strong integration as SharePoint 2013 uses this for advanced workflows.
  • Workflow Manager and Workflow Client are two separate MSI's. One is used for the manager, obviously, and the client is for servers connecting to the manager. It's installed together with the manager, however for additional servers the client MSI's must be installed separately, no configuration required.
  • Installing Workflow Manager requires Web Platform Installer, which I for one, does not want installed on my server. Using the Web Platform Installer also requires internet access, which not all companies allow from their servers.
  • The script calls the MSI without the Web Platform installer requirements, thus making it possible to do scripted installation as well as offline installation.
  • In general the Workflow Manager installation is separated into multiple minor applications. Service Bus, Manager, Client - which can lead to a confusing situation when to decide what to use. The parameter list should aid in the overview.
  • At the time of writing, I recommend using the self-signed certificate, due to limitations in workflow manager on using a custom name certificate.

The script below will make use of offline MSI files for the installation. So make sure you grab those before you run the script. They should be located in the same folder as the script before you run it.

The script

001.Set-Location (Split-Path -Parent -Path $MyInvocation.MyCommand.Definition)
002.Clear-Host
003.  
004.#region Variables
005.$SQLserver = '<SQL SERVER>' # Name of the database server.
006.$DBprefix = '<Database Pre-fix>' # All databases will be prefixed with this string.
007.  
008.$SBRunAsAccount = '<Service Bus service account>' # The account under which the service runs. This account must be a domain account.
009.$SBRunAsPasswordString = '<Service Bus service Account passwprd>' # Password for RunAs account (in cleartext).
010.$SBAdminGroup = '<Service Bus Administrator group>' # The admin group for Service Bus. (Default "BUILTIN\Administrators")
011.$SBCertificateAutoGenerationKey = '<Certificate passphrase>' # This passphrase is required for certificate auto generation. This parameter is mandatory if you want certificates to be auto generated.
012.$TcpPort = <Service Bus port> # The port that the Service Bus for Windows Server uses for TCP. (Default 9354)
013.$MessageBrokerPort = <Message Broker port> 9356 # The port that the Service Bus for Windows Server uses for MessageBroker communication. (Default 9356)
014.$InternalPortRangeStart = <Port Range> # The start of the port range that Service Bus for Windows Server uses for internal communication purposes. (Default 9000)
015.  
016.$WFRunAsAccount = '<Service Bus service account>' # The account under which the service will be running. This account must be a domain account.
017.$WFRunAsPasswordString = '<Service Bus service account password>' # Password for RunAs account (in cleartext).
018.$WFAdminGroup = '<Service Bus Administrator group>' # The set of users who are considered workflow administrators. (Default BUILTIN\Administrators)
019.$WFCertificateAutoGenerationKey = '<Certificate Passphrase>' # This passphrase is required for certificate auto generation. This is a mandatory parameter if you want certificates to be auto generated.
020.$HttpsPort = <Workflow HTTPS Port> # The port that will be used by the workflow for HTTPS communication. (Default 12290)
021.$HttpPort = <Workflow HTTP Port> # The port that will be used by the workflow for HTTP communication. (Default 12291)
022.  
023.$SBNamespace = '<Service Bus Namespace>' # Specifies the name for the new Service Bus for Windows Server service namespace.
024.$AddressingScheme = 'Path' # Specifies the addressing scheme used in the service namespace. The possible values for this parameter are Path (default value) and DNSRegistered. If the value DNSRegistered is specified, the -DnsEntry parameter is required.
025.$ManageUsers = '<Workflow Namespace Administrator01>','<Workflow Namespace Administrator02>' # Specifies user or group names that will be managers of the service namespace.
026.  
027.#Filelocations:
028.$WF  = "WindowsFabric.msi"
029.$SB  = "Service_Bus.msi"
030.$WMC = "WorkflowManagerClient_x64.msi"
031.$WM  = "Workflow_Manager.msi"
032.  
033.## Can't touch this... or anything below this line ;P
034.  
035.$Sleep = 90 # Sleep duration is set to 90 seconds because that what all the cool kids online are doing.
036.  
037.$ArgumentList = 'IACCEPTEULA=yes WEBPI=1 /QUIET /NORESTART'
038.<#
039.    "IACCEPTEULA=yes" is required for quiet install of Windows Fabric,
040.    "WEBPI=1" is required for installation of Service Bus and Workflow Manager outside of the Web Platform Installer,
041.    "/QUIET" = Quiet mode, no user interaction,
042.    "/NORESTART" = Do not restart after the installation is complete.
043.#>
044.  
045.$fileNotFound = $null
046.#endregion
047.  
048.Write-Host "VERIFYING THAT FILES EXIST:"
049.$files = $WF,$SB,$WMC,$WM
050.foreach ($file in $files) {
051.    if (Test-Path -Path $file){
052.        Write-Host "✓ $file" -ForegroundColor Green
053.    }else{Write-Host "X $file" -ForegroundColor Red;$fileNotFound = $true}
054.}if ($fileNotFound -eq $true){Exit}
055.''
056.foreach ($file in $files) {
057.    Write-Host "Installing $file... " -NoNewline
058.    Start-Process $file -ArgumentList $ArgumentList -Wait
059.    Write-Host "Done"
060.}
061.  
062.[Environment]::SetEnvironmentVariable("PSModulePath", [Environment]::GetEnvironmentVariable("PSModulePath","Machine"))
063.Import-Module WorkflowManager
064.  
065.#region StringBuilding
066.# The strings are created like this to make it easier to put them on different SQL servers
067.function BuildString ($type, $dbName, $SQLserver) {
068.    New-Variable -Name $type'DBConnectionStringDataSource' -Value $SQLserver
069.    New-Variable -Name $type'DBConnectionStringInitialCatalog' -Value $DBprefix$dbName
070.    New-Variable -Name $type'DBConnectionString' -Scope Script -Value ("Data Source="+(Get-Variable -Name $type'DBConnectionStringDataSource' -ValueOnly)+";Initial Catalog="+(Get-Variable -Name $type'DBConnectionStringInitialCatalog' -ValueOnly)+";Integrated Security=True;Encrypt=False") -Force
071.}
072.  
073.# Example ConnectionString: Data Source=SQL01;Initial Catalog=Udv_service_SBManagement;Integrated Security=True;Encrypt=False
074.BuildString SBFarm SBManagement $SQLserver
075.BuildString GateWay SBGateway $SQLserver
076.BuildString MessageContainer SBMessageContainer $SQLserver
077.BuildString WFFarm WFManagement $SQLserver
078.BuildString Instance WFInstanceManagement $SQLserver
079.BuildString Resource WFResourceManagement $SQLserver
080.#endregion
081.  
082.$SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String $SBCertificateAutoGenerationKey -Verbose
083.New-SBFarm -SBFarmDBConnectionString $SBFarmDBConnectionString -InternalPortRangeStart $InternalPortRangeStart -TcpPort $TcpPort -MessageBrokerPort $MessageBrokerPort -RunAsAccount $SBRunAsAccount -AdminGroup $SBAdminGroup -GatewayDBConnectionString $GatewayDBConnectionString -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString $MessageContainerDBConnectionString -Verbose
084.New-WFFarm -WFFarmDBConnectionString $WFFarmDBConnectionString -RunAsAccount $WFRunAsAccount -AdminGroup $WFAdminGroup -HttpsPort $HttpsPort -HttpPort $HttpPort -InstanceDBConnectionString $InstanceDBConnectionString -ResourceDBConnectionString $ResourceDBConnectionString -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose
085.  
086.$SBRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String $SBRunAsPasswordString -Verbose
087.Add-SBHost -SBFarmDBConnectionString $SBFarmDBConnectionString -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose
088.  
089.Try {
090.    New-SBNamespace -Name $SBNamespace -AddressingScheme $AddressingScheme -ManageUsers $ManageUsers -Verbose
091.    for ($i=$Sleep; $i -gt 1; $i--) {
092.        Write-Progress -Activity "Creating new SB Namespace" -Status "Sleeping" -SecondsRemaining $i
093.        Start-Sleep 1
094.    }
095.}
096.Catch [system.InvalidOperationException]{}
097.  
098.$SBClientConfiguration = Get-SBClientConfiguration -Namespaces $SBNamespace -Verbose
099.$WFRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String $WFRunAsPasswordString -Verbose
100.Add-WFHost -WFFarmDBConnectionString $WFFarmDBConnectionString -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -CertificateAutoGenerationKey (ConvertTo-SecureString $WFCertificateAutoGenerationKey -AsPlainText -Force) -Verbose

(The script is currently using a self-signed certificate.)

How to get MSI files
WebPICMD.exe /offline /products:”WindowsFabric,ServiceBus_1_1,WorkflowManager” /Path:c:\temp\

WindowsFabric.msi
WebPICMD.exe /offline /products:WindowsFabric /Path:c:\temp\

Service_Bus.msi
WebPICMD.exe /offline /Products:ServiceBus_1_1 /Path:c:\temp\

WorkflowManagerClient_x64.msi
WebPICMD.exe /offline /Products:WorkflowManager /Path:c:\temp\

Workflow_Manager.msi
WebPICMD.exe /offline /Products:WorkflowManager /Path:c:\temp\

Source:
https://jesperarnecke.wordpress.com/2015/06/16/workflow-manager-scripted-installation/