Last active
April 25, 2018 19:01
-
-
Save mirontoli/6cf66c72c0fae9b6947592fa13c34d8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script is generated by workflow manager configuration wizard | |
# I have extracted variables to parameters | |
# an alternative to this script can be found on | |
# Rob Garret's blog: https://blog.robgarrett.com/2014/05/12/install-workflow-manager-with-powershell/ | |
# Author @mirontoli 2018-04-24 | |
# an example of usage: | |
# .\configure-wfm.ps1 -dbServer SPWorkFlow -dbPrefix dev_ -spServiceAcctName contoso\wfm_service -spServiceAcctPWD "P@ssword" -passphrase "Blablabal" | |
param( | |
$dbServer, # – SQL Alias for my SQL server (best to use an alias not the server name) | |
$dbPrefix, # – Prefix for all my database names ISI_Integ_ | |
$spServiceAcctName, # – Name of my service account (used for workflow manager) | |
$spServiceAcctPWD, # – Password for my service account | |
$passphrase # – Passphrase used by WFM when joining new hosts to the farm | |
) | |
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed. | |
# Create new SB Farm | |
$SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String $passphrase -Verbose; | |
New-SBFarm -SBFarmDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)SbManagementDB;Integrated Security=True;Encrypt=False' \ | |
-InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 \ | |
-RunAsAccount $spServiceAcctName -AdminGroup 'BUILTIN\Administrators' \ | |
-GatewayDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)SbGatewayDatabase;Integrated Security=True;Encrypt=False' \ | |
-CertificateAutoGenerationKey $SBCertificateAutoGenerationKey \ | |
-MessageContainerDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)SBMessageContainer01;Integrated Security=True;Encrypt=False' -Verbose; | |
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed. | |
# Create new WF Farm | |
$WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String $passphrase -Verbose; | |
New-WFFarm -WFFarmDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)WFManagementDB;Integrated Security=True;Encrypt=False' \ | |
-RunAsAccount $spServiceAcctName \ | |
-AdminGroup 'BUILTIN\Administrators' -HttpsPort 12290 -HttpPort 12291 \ | |
-InstanceDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)WFInstanceManagementDB;Integrated Security=True;Encrypt=False' \ | |
-ResourceDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)WFResourceManagementDB;Integrated Security=True;Encrypt=False' \ | |
-CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose; | |
# Add SB Host | |
$SBRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String $passphrase -Verbose; | |
Add-SBHost -SBFarmDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)SbManagementDB;Integrated Security=True;Encrypt=False' \ | |
-RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose; | |
Try | |
{ | |
# Create new SB Namespace | |
New-SBNamespace -Name 'WorkflowDefaultNamespace' -AddressingScheme 'Path' -ManageUsers $spServiceAcctName,$(whoami) -Verbose; | |
Start-Sleep -s 90 | |
} | |
Catch [system.InvalidOperationException] | |
{ | |
} | |
# Get SB Client Configuration | |
$SBClientConfiguration = Get-SBClientConfiguration -Namespaces 'WorkflowDefaultNamespace' -Verbose; | |
# Add WF Host | |
$WFRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String $spServiceAcctPWD -Verbose; | |
Add-WFHost -WFFarmDBConnectionString 'Data Source=$($dbServer);Initial Catalog=$($dbPrefix)WFManagementDB;Integrated Security=True;Encrypt=False' \ | |
-RunAsPassword $WFRunAsPassword -EnableFirewallRules $true \ | |
-SBClientConfiguration $SBClientConfiguration -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# these lines should be run one by one | |
# Install Web Platform Installer on every server: | |
function Install-WebPi { | |
if (Test-Path "C:\Program Files\Microsoft\Web Platform Installer\WebPICmd.exe") { | |
$url = "http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi" | |
$output = "webpi.msi" | |
(New-Object System.Net.WebClient).DownloadFile($url, $output) | |
& ".\$output" /quiet | |
} else { | |
Write-HOst -ForegroundColor Red "You already have Web Pi" | |
} | |
} | |
# Install WFM (Workflow Manager) on the server where you want to install WFM, will reboot | |
& "C:\Program Files\Microsoft\Web Platform Installer\WebPICmd.exe" /Install /Products:WorkflowManagerRefresh /AcceptEULA # needs reboot | |
# Update WFM (on the same WFM server) | |
& "C:\Program Files\Microsoft\Web Platform Installer\WebPICmd.exe" /Install /Products:WorkflowCU5 /AcceptEULA | |
# Install Client on every server in SP Farm (except the Workflow Manager server): | |
& "C:\Program Files\Microsoft\Web Platform Installer\WebPICmd.exe" /Install /Products:WorkflowClientCU4 /AcceptEULA | |
# Register WFM (on a server in SharePoint farm) | |
asnp *share* | |
$spUrl = "https://sp.contoso.com" | |
$wfm = "wfm" #fqdn e.g. server1.chuvash.eu | |
# 12290 - https (12991 http, but we don't use it) | |
Register-SPWorkflowService -SPSite $spUrl -WorkflowHostUri https://$wfm:12290 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment