Hi
Came across an error that is down to a syntax change in 2013. Amended below
```
#Region Create State Service Application Over-ride
# ===================================================================================
# In SP2010 the Database Server isn't accepted in New-SPStateServiceDatabase so created
# an IF Statement that looks at the install version and gives different commands dependant on that
# ===================================================================================
Function CreateStateServiceApp([xml]$xmlinput)
{
$stateService = $xmlinput.Configuration.ServiceApps.StateService
If (ShouldIProvision($stateService) -eq $true)
{
WriteLine
Try
{
$dbServer = $stateService.Database.DBServer
# If we haven't specified a DB Server then just use the default used by the Farm
If ([string]::IsNullOrEmpty($dbServer))
{
$dbServer = $xmlinput.Configuration.Farm.Database.DBServer
}
$stateServiceDB = $dbPrefix+$stateService.Database.Name
$stateServiceName = $stateService.Name
$stateServiceProxyName = $stateService.ProxyName
If ($stateServiceName -eq $null) {$stateServiceName = "State Service Application"}
If ($stateServiceProxyName -eq $null) {$stateServiceProxyName = $stateServiceName}
$getSPStateServiceApplication = Get-SPStateServiceApplication
If ($getSPStateServiceApplication -eq $null)
{
Write-Host -ForegroundColor White " - Provisioning State Service Application..."
#Added by James Murray @ Ridgian
If ($xmlinput.Configuration.Install.SPVersion -eq "2013")
{
New-SPStateServiceDatabase -DatabaseServer $dbServer -Name $stateServiceDB | Out-Null
}
else
{
New-SPStateServiceDatabase -Name $stateServiceDB | Out-Null
}
#End of Addition
New-SPStateServiceApplication -Name $stateServiceName -Database $stateServiceDB | Out-Null
Get-SPStateServiceDatabase | Initialize-SPStateServiceDatabase | Out-Null
Write-Host -ForegroundColor White " - Creating State Service Application Proxy..."
Get-SPStateServiceApplication | New-SPStateServiceApplicationProxy -Name $stateServiceProxyName -DefaultProxyGroup | Out-Null
Write-Host -ForegroundColor White " - Done creating State Service Application."
}
Else {Write-Host -ForegroundColor White " - State Service Application already provisioned."}
}
Catch
{
Write-Output $_
Throw " - Error provisioning the state service application"
}
WriteLine
}
}
#EndRegion
```
Came across an error that is down to a syntax change in 2013. Amended below
```
#Region Create State Service Application Over-ride
# ===================================================================================
# In SP2010 the Database Server isn't accepted in New-SPStateServiceDatabase so created
# an IF Statement that looks at the install version and gives different commands dependant on that
# ===================================================================================
Function CreateStateServiceApp([xml]$xmlinput)
{
$stateService = $xmlinput.Configuration.ServiceApps.StateService
If (ShouldIProvision($stateService) -eq $true)
{
WriteLine
Try
{
$dbServer = $stateService.Database.DBServer
# If we haven't specified a DB Server then just use the default used by the Farm
If ([string]::IsNullOrEmpty($dbServer))
{
$dbServer = $xmlinput.Configuration.Farm.Database.DBServer
}
$stateServiceDB = $dbPrefix+$stateService.Database.Name
$stateServiceName = $stateService.Name
$stateServiceProxyName = $stateService.ProxyName
If ($stateServiceName -eq $null) {$stateServiceName = "State Service Application"}
If ($stateServiceProxyName -eq $null) {$stateServiceProxyName = $stateServiceName}
$getSPStateServiceApplication = Get-SPStateServiceApplication
If ($getSPStateServiceApplication -eq $null)
{
Write-Host -ForegroundColor White " - Provisioning State Service Application..."
#Added by James Murray @ Ridgian
If ($xmlinput.Configuration.Install.SPVersion -eq "2013")
{
New-SPStateServiceDatabase -DatabaseServer $dbServer -Name $stateServiceDB | Out-Null
}
else
{
New-SPStateServiceDatabase -Name $stateServiceDB | Out-Null
}
#End of Addition
New-SPStateServiceApplication -Name $stateServiceName -Database $stateServiceDB | Out-Null
Get-SPStateServiceDatabase | Initialize-SPStateServiceDatabase | Out-Null
Write-Host -ForegroundColor White " - Creating State Service Application Proxy..."
Get-SPStateServiceApplication | New-SPStateServiceApplicationProxy -Name $stateServiceProxyName -DefaultProxyGroup | Out-Null
Write-Host -ForegroundColor White " - Done creating State Service Application."
}
Else {Write-Host -ForegroundColor White " - State Service Application already provisioned."}
}
Catch
{
Write-Output $_
Throw " - Error provisioning the state service application"
}
WriteLine
}
}
#EndRegion
```