Created
September 4, 2014 10:54
-
-
Save rheid/93fad58069b1a62e786b to your computer and use it in GitHub Desktop.
Setup new The State Service
This file contains hidden or 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
| # The State Service is required in order to use the out-of-the-box workflows in | |
| # SharePoint Server 2010 (e.g. Approval - SharePoint 2010) or any other features | |
| # that leverage InfoPath Forms Services. | |
| # | |
| # When using the Farm Configuration Wizard to configure the State Service, the | |
| # resulting database is named StateService_{GUID}. In order to avoid lengthy | |
| # database names containing GUIDs, the State Service is configured using PowerShell. | |
| function ConfigureStateService( | |
| [string] $stateServiceName = $(Throw "Value cannot be null: stateServiceName"), | |
| [string] $stateServiceDatabaseName = | |
| $(Throw "Value cannot be null: stateServiceDatabaseName")) | |
| { | |
| Write-Host "Configuring the State Service..." | |
| Write-Debug "stateServiceName: $stateServiceName" | |
| Write-Debug "stateServiceDatabaseName: $stateServiceDatabaseName" | |
| $serviceApp = Get-SPStateServiceApplication -Identity "$stateServiceName" ` | |
| -Debug:$false -EA 0 | |
| If ($serviceApp -ne $null) | |
| { | |
| Write-Host "The State Service has already been configured." | |
| return | |
| } | |
| $database = New-SPStateServiceDatabase -Name $stateServiceDatabaseName ` | |
| -Debug:$false | |
| $serviceApp = New-SPStateServiceApplication -Name $stateServiceName ` | |
| -Database $database -Debug:$false | |
| New-SPStateServiceApplicationProxy -ServiceApplication $serviceApp ` | |
| -Name $stateServiceName -DefaultProxyGroup -Debug:$false > $null | |
| Write-Host -Fore Green "Successfully configured the State Service." | |
| } | |
| function Main() | |
| { | |
| $stateServiceName = "State Service" | |
| $stateServiceDatabaseName = "HDTP_States" | |
| ConfigureStateService $stateServiceName $stateServiceDatabaseName | |
| } | |
| Main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment