New-SPStateServiceDatabase
Creates and provisions a new state service database and installs the state database schema into it.
Syntax
New-SPStateServiceDatabase
[-Name] <String>
[-AssignmentCollection <SPAssignmentCollection>]
[-DatabaseCredentials <PSCredential>]
[-DatabaseServer <String>]
[-ServiceApplication <SPStateServiceApplicationPipeBind>]
[-Weight <Int32>]
[<CommonParameters>]
Description
The New-SPStateServiceDatabase
cmdlet creates and a new state service database.
This cmdlet installs the session state database schema in the state service database.
For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.
Examples
--------------EXAMPLE 1-----------------
New-SPStateServiceDatabase -Name 'State Service'
This example creates a new state service database.
Parameters
-AssignmentCollection
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.
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.
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-DatabaseCredentials
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.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-DatabaseServer
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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Name
Specifies the name for the state service database that is stored in SQL Server.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ServiceApplication
Specifies the state service application to add the state database to.
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.
Type: | SPStateServiceApplicationPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Weight
Specifies the weight for the state database. The default value is 1.
This parameter is used when new rows of data are allocated among the collection of databases that are associated with a service application
The type must be a valid integer in the range of 1 to 10.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |