The Mount-SPStateServiceDatabase cmdlet attaches an existing state service database to the farm. If the session state database schema is not installed in the state service database, use the Initialize-SPStateServiceDatabase cmdlet to install the schema after the state service database has been mounted.

Specifies the database name that is created in the SQL Server database.

AssignmentCollection

Optional

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

Note:

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

DatabaseCredentials

Optional

System.Management.Automation.PSCredential

Specifies the database credentials for SQL Authentication used to access the state service database. If this parameter is not specified, Windows authentication is used.

The type must be a valid PSCredential object.

DatabaseServer

Optional

System.String

Specifies the name of the host server for the state service database.

The type must be a valid SQL Server host name; for example, SQLServerHost1.

Specifies the state service application to which to add the state database.

The type must be a valid name of a state service application (for example, StateServiceApp1); a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or an instance of a valid SPStateServiceApplication object.

Weight

Optional

System.Nullable

Specifies the weight for the state database used to load balance the allocation of new data. The default value is 1.

This example associates a SharePoint Server 2013 farm with a SQL Server database.

This example is used in least privilege scenarios when an administrator cannot create databases in SQL. The database must already exist and be empty. The database cannot be used until the Initialize-SPStateServiceDatabase cmdlet is run, so errors could occur with this example.

This example associates a SharePoint Server 2013 farm with a SQL Server database, at the same time that it also associates the database with a service application and gives a weight of 10. The result is immediately piped to the Initialize-SPStateServiceDatabase cmdlet so that the database can be used.