PowerShell for SharePoint (on-prem), SharePoint 2013, SharePoint 2016

Create the State Service Application in SharePoint Server using PowerShell

The State Service Application is used to store the status of some of the SharePoint components.
This service application can be created via SharePoint Central Admin when running the Configuration Wizard, but you’ll end up having the GUID alongside the database name, and that’s not nice!

With only a few PowerShell cmdlets, you can create the State Service Application, and also make your SQL DBA happy! 🙂

Assuming you have the correct permissions to run PowerShell scripts/cmdlets, let’s dive in!

 

Create variables for the State Service Application

  • Open your preferred PowerShell editor (personally I use Visual Studio Code which is free, and FULL of goodness!)
  • Add the SharePoint Snapin (if you’re not in the SharePoint Management Shell)
  • Create a few variables (adapt to your liking!)
    • $ServiceAppName = “State Service Application”
    • $ServiceAppProxyName = “State Service Application Proxy”
    • $DBName = “SP2016_State_Service_DB”

 

Now it’s time to create the State Service Application and its database

#Create New State Service application
$StateServiceApp = New-SPStateServiceApplication -Name $ServiceAppName

#Create Database for State Service App
$Database = New-SPStateServiceDatabase -Name $DBName -ServiceApplication $StateServiceApp 
 
#Create Proxy for State Service
New-SPStateServiceApplicationProxy -Name $ServiceAppProxyName -ServiceApplication $StateServiceApp -DefaultProxyGroup 

#Initialize the State Service DB
Initialize-SPStateServiceDatabase -Identity $Database

 

There you have it!

StateServApp
State Service Application in CA

 

StateServAppDB
State Service database in SQL Server

 

Loading Likes... Tagged , , ,

Leave a Reply