Disable-SPSessionStateService
Example
[image]

Turns off the session state service on the farm.

Disable-SPSessionStateService [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Disable-SPSessionStateService cmdlet to turn off the session state service. By default, session state is enabled. Disable session state for troubleshooting purposes.

Note:
When session state is disabled, many Microsoft SharePoint Server 2010services and components will no longer function. Changing this property will modify the Web.config file on every content Web application on every server in the farm.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Disable-SPSessionStateService

This example disables the session state service.
Click here to submit feedback on this topic.


Dismount-SPStateServiceDatabase
Example
[image]

Removes a state service.

Dismount-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to remove from the service application.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Dismount-SPStateServiceDatabase cmdlet remove a state service database from a service application and delete the associated SharePoint object. This cmdlet does not delete or alter the state service database.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Dismount-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example removes a state service database for a specified identity.


Enable-SPSessionStateService
Example
[image]

Provisions a session state database and turns on the session state service.

Enable-SPSessionStateService -DatabaseName <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseCredentials <PSCredential>] [-DatabaseServer <String>] [-SessionTimeout <Nullable>] [-WhatIf [<SwitchParameter>]]
Enable-SPSessionStateService -DefaultProvision <SwitchParameter> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-SessionTimeout <Nullable>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Set 1

Parameter

Required

Type

Description

DatabaseName

Required

System.String

Specifies the name of the database for the enabled session state service.

The type must be a valid name of a SQL Server database; for example, SessionStateDB1.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

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.

SessionTimeout

Optional

System.Nullable

Specifies the time, in seconds, that a session state service will remain active with no user activity.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Parameter Set 2

Parameter

Required

Type

Description

DefaultProvision

Required

System.Management.Automation.SwitchParameter

Specifies that the default provisioning settings are used. The default provisioning settings are: Windows Authentication, Auto SQL Server (configuration database), and Auto Catalog Name.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

SessionTimeout

Optional

System.Nullable

Specifies the time, in seconds, that a session state service will remain active with no user activity.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Enable-SPSessionStateService cmdlet to provision a session state database, install the ASP.NET session state schema, and update the web.config files on the farm to turn on the session state service and to use the SPSessionsStateService IPartitionResolver code.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE 1-----------------
Copy Code
Enable-SPSessionStateService -DefaultProvision True

This example provisions a session state service database and enables default provisioning.

--------------EXAMPLE 2-----------------
Copy Code
Enable-SPSessionStateService -DatabaseName "Session State Database" -DatabaseServer "localhost"

This example provisions a session state database with a specified database name and server.


Get-SPSessionStateService
Example
[image]

Returns the properties of a session state database.

Get-SPSessionStateService [-AssignmentCollection <SPAssignmentCollection>]

Parameters

Parameter Required Type Description

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:

Detailed Description

Use the Get-SPSessionStateService cmdlet to read the properties of a session state database.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Get-SPSessionStateService

This example displays all session state databases.


Get-SPStateServiceApplication
Example
[image]

Returns state service applications on the farm.

Get-SPStateServiceApplication [-Identity <SPStateServiceApplicationPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

Specifies the state service application to get.

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.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Get-SPStateServiceApplication cmdlet to return a state service application on the farm. If the Identity parameter is not specified, this cmdlet returns the collection of state service applications on the farm.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Get-SPStateServiceApplication

This example displays all state services in the farm.


Get-SPStateServiceApplicationProxy
Example
[image]

Returns state service application proxies on the farm.

Get-SPStateServiceApplicationProxy [-Identity <SPStateServiceApplicationProxyPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationProxyPipeBind

Specifies the state service application proxy to get.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Get-SPStateServiceApplicationProxy cmdlet to return a state service application proxy on the farm. If the Identity parameter is not specified, this cmdlet returns the collection of state service application proxies on the farm.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Get-SPStateServiceApplicationProxy

This example displays all the proxies for a state service application.


Get-SPStateServiceDatabase
Example
[image]

Returns a state service database.

Get-SPStateServiceDatabase [-Identity <SPStateDatabasePipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
Get-SPStateServiceDatabase [-ServiceApplication <SPStateServiceApplicationPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Set 1

Parameter

Required

Type

Description

Identity

Optional

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to get.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Parameter Set 2

Parameter

Required

Type

Description

ServiceApplication

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

Filters to return only the state service database associated with the specified state service application.

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.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Get-SPStateServiceDatabase cmdlet to return a state service database on the farm. If the Identity parameter is not specified, this cmdlet returns the collection of state service databases on the farm.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE----------------
Copy Code
Get-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example displays the state service database for a specified identity.

--------------EXAMPLE 2--------------
Copy Code
Get-SPStateServiceDatabase

This example displays all state service databases in the farm.


Initialize-SPStateServiceDatabase
Example
[image]

Installs the state database schema in a state service database.

Initialize-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to initialize.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Initialize-SPStateServiceDatabase cmdlet to install the session state database schema in a state service database. The current user's credentials are used to create the state database schema.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Initialize-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example initializes a session state database for a specified identity.


Mount-SPStateServiceDatabase
Example
[image]

Attaches an existing state service database to the farm.

Mount-SPStateServiceDatabase -Name <String> [-AssignmentCollection <SPAssignmentCollection>] [-DatabaseCredentials <PSCredential>] [-DatabaseServer <String>] [-ServiceApplication <SPStateServiceApplicationPipeBind>] [-Weight <Nullable>]

Parameters

Parameter Required Type Description

Name

Required

System.String

Specifies the proxy for the state service associated with the state service database.

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

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:

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.

ServiceApplication

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

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.

Weight

Optional

System.Nullable

Specifies the weight for the state database. The default value is 5.

The type must be a valid integer in the range of 1 to 10.

Detailed Description

Use the Mount-SPStateServiceDatabase cmdlet to attach 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.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Get-SPStateServiceApplication -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b | Mount-SPStateServiceDatabase -Name "statedata1" -DatabaseServer "localhost"

This example attaches a service database using a specified proxy named "statedata1" and database server named "localhost".


New-SPStateServiceApplication
Example
[image]

Creates a new state service application.

New-SPStateServiceApplication -Name <String> [-AssignmentCollection <SPAssignmentCollection>] [-Database <SPStateDatabasePipeBind>]

Parameters

Parameter Required Type Description

Name

Required

System.String

Specifies the name of the new service application.

The type must be a valid name of a service application; for example, StateSvcApp1.

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:

Database

Optional

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database that is associated with the new service application.

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

Detailed Description

Use the New-SPStateServiceApplication cmdlet to create a new state service application on the farm. A State Service Application is the container for state service databases.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE 1-----------------
Copy Code
New-SPStateServiceApplication -Name "State Service Application 1"

The following example creates a new state service application named, State Service Application 1 on the farm.

State service applications are the container for databases. State Service Applications must have a Proxy and a Database created to be usable.

--------------EXAMPLE 2-----------------
Copy Code
New-SPStateServiceDatabse -Name "State Service Database" | New-SPStateServiceApplication -Name "StateServiceApp1" | New-SPStateServiceApplicationProxy -DefaultProxyGroup

This example creates a new state service application with a proxy named, "State Service Database".

This example simulates the SharePoint Product and Technologies Configuration Wizard behavior.


New-SPStateServiceApplicationProxy
Example
[image]

Creates a proxy for a state service application.

New-SPStateServiceApplicationProxy -ServiceApplication <SPStateServiceApplicationPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-DefaultProxyGroup <SwitchParameter>] [-Name <String>]

Parameters

Parameter Required Type Description

ServiceApplication

Required

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

Specifies the state service application to associate with the new proxy.

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.

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:

DefaultProxyGroup

Optional

System.Management.Automation.SwitchParameter

Specifies that the service application proxy is added to the farm's default proxy group.

Name

Optional

System.String

Specifies the display name of the new proxy.

The type must be a valid name of a SQL Server database; for example, SessionStateDB1. Service application proxy; for example, StateSvcAppProxy1

Detailed Description

Use the New-SPStateServiceApplicationProxy cmdlet to create a proxy for a state service application.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-------------------
Copy Code
Get-SPServiceApplication -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b | New-SPStateServiceApplicationProxy -DefaultProxyGroup

The following example creates a new service application proxy, and associates with a provided service application, and adds it to the farm's default proxy group.


New-SPStateServiceDatabase
Example
[image]

Creates and provisions a new state service database, and installs the State Database schema into it.

New-SPStateServiceDatabase -Name <String> [-AssignmentCollection <SPAssignmentCollection>] [-DatabaseCredentials <PSCredential>] [-DatabaseServer <String>] [-ServiceApplication <SPStateServiceApplicationPipeBind>] [-Weight <Nullable>]

Parameters

Parameter Required Type Description

Name

Required

System.String

Specifies the name for the state service database stored in SQL Server.

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:

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.

ServiceApplication

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

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.

Weight

Optional

System.Nullable

Specifies the weight for the state database. The default value is 5.

This parameter is used when new rows of data are allocated among the collection of databases associated with a service application

The type must be a valid integer in the range of 1 to 10.

Detailed Description

Use the New-SPStateServiceDatabase cmdlet to create and provisions a new state service database. This cmdlet installs the session state database schema in the state service database.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE 1-----------------
Copy Code
Get-SPStateServiceApplication -name "State Service Application 1" | New-SPStateServiceDatabase -Name "statedata1" -DatabaseServer "localhost"

The following example creates a new state service database by using Windows authentication, and associates it with the provided service application.

--------------EXAMPLE 2-----------------
Copy Code
$cred = Get-Credential
Copy Code
Get-SPStateServiceApplication -name "State Service Application 1" | New-SPStateServiceDatabase -Name "statedata1" -DatabaseServer "localhost" -DatabaseCredentials $cred

The following example creates a new state service database, configured to use SQL Server authentication, and associates it with the provided service application.


Remove-SPStateServiceDatabase
Example
[image]

Removes a state service database from a state service application and drops it from the SQL Server.

Remove-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to remove.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Remove-SPStateServiceDatabase cmdlet to remove a state service database from a state service application and delete the database. To remove a state service database and not delete the database, use the Dismount-SPStateServiceDatabase cmdlet.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Remove-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

The following example removes the specified database from a Microsoft SharePoint Server 2010 farm and drops the database from the SQL server (data loss).


Resume-SPStateServiceDatabase
Example
[image]

Unpauses a state service database so that new rows of data are received.

Resume-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to resume.

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

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Remove-SPStateServiceDatabase cmdlet to un-pause a state service database which adds it to the set of databases that may receive new data as required by Microsoft SharePoint Server 2010 applications.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE------------------
Copy Code
Resume-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example resumes a paused state service application.


Set-SPSessionStateService
Example
[image]

Updates the credentials used for communicating with the state service database.

Set-SPSessionStateService [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseCredentials <PSCredential>] [-SessionTimeout <Nullable>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

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.

SessionTimeout

Optional

System.Nullable

Specifies the time, in minutes that an ASP.NET session will remain active with no user activity.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Set-SPSessionStateService cmdlet to update the credentials that are used for communicating with the state service database.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Set-SPSessionStateService -SessionTimeout 120

This example changes the ASP.NET session state timeout to 2 hours.


Set-SPStateServiceApplication
Example
[image]

Updates the name of a state service application.

Set-SPStateServiceApplication -Identity <SPStateServiceApplicationPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Name <String>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

Specifies the state service application to update.

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.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Name

Optional

System.String

Specifies the display name of the state service application.

The type must be a valid name of a state service application; for example, StateSvc1.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Set-SPStateServiceApplication cmdlet to update the name of a state service application.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Set-SPStateServiceApplication -Identity "State Service Application 1" -Name "New name for State Service Application 1"

This example changes the display name of a State Service Application.


Set-SPStateServiceApplicationProxy
Example
[image]

Updates the name of a state service application proxy.

Set-SPStateServiceApplicationProxy -Identity <SPStateServiceApplicationProxyPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Name <String>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateServiceApplicationProxyPipeBind

Specifies the state service application proxy to update.

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

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.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Name

Optional

System.String

Specifies the display name of the state service application proxy.

The type must be a valid name of a state service application; for example, StateSvcProxy1.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Detailed Description

Use the Set-SPStateServiceApplicationProxy cmdlet to update the name of a state service application proxy.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Set-SPServiceApplicationProxy -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b -Name "New Service Application Proxy Name"

This example changes the display name of a state service application proxy.


Set-SPStateServiceDatabase
Example
[image]

Updates properties of a state service database.

Set-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-ServiceApplication <SPStateServiceApplicationPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseCredentials <PSCredential>] [-Weight <Nullable>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state service database to update.

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

ServiceApplication

Optional

Microsoft.Office.Server.Administration.SPStateServiceApplicationPipeBind

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.

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:

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

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.

Weight

Optional

System.Nullable

Specifies the weight for the state database. The default value is 5.

The type must be a valid integer in the range of 1 to 10.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Set-SPStateServiceDatabase cmdlet to manage the credentials used to communicate with the database, set the weight of the database, or change the state service application it is associated with.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE 1--------------
Copy Code
Set-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b -Weight 10

This example updates the database weight to the maximum (10).

--------------EXAMPLE 2--------------
Copy Code
Get-SPServiceApplication -Identity "StateSvcApp1" | Set-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example updates the associated service application for a state service database.

--------------EXAMPLE 3--------------
Copy Code
$cred = Get-Credential
Copy Code
Set-SPStateServiceDatabase -Identity "StateSvcDB1" -DatabaseCredentials $cred

This example updates the SQL authentication credentials used for a given database.


Suspend-SPStateServiceDatabase
Example
[image]

Pauses a state database which prevents new rows of data from being added to a database.

Suspend-SPStateServiceDatabase -Identity <SPStateDatabasePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Office.Server.Administration.SPStateDatabasePipeBind

Specifies the state database to pause.

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

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.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

Use the Suspend-SPStateServiceDatabase cmdlet to pause a state database. This cmdlet updates the state database object specified in the Identity paramater.

Input Types

Return Types

Errors

Error | Description

Exceptions

Exceptions | Description

Example

--------------EXAMPLE-----------------
Copy Code
Suspend-SPStateServiceDatabase -Identity 9703f7e2-9521-47c3-bd92-80e3eeba391b

This example suspends a specified state service database.