Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Enable-SPSessionStateService

Published: July 16, 2012

Applies to:  SharePoint Server 2013 Enterprise 

Creates 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

1

Parameter

Required

Type

Description

DatabaseName

Required

System.String

Specifies the name of the database for the 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.

noteNote:

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

DatabaseCredentials

Optional

System.Management.Automation.PSCredential

Specifies the database credentials for SQL Authentication used to access the session 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 host SQL 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 minutes, that a ASP .NET session state service will remain active with no user activity. The default value is 60.

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

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.

noteNote:

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

SessionTimeout

Optional

System.Nullable

Specifies the time, in minutes, that a ASP .NET session state service will remain active with no user activity. The default value is 60.

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

This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.

The Enable-SPSessionStateService cmdlet creates a session state database, installs the ASP.NET session state schema, and updates the Web.config files on the farm to turn on the session state service.

Input Types

Return Types

--------------EXAMPLE 1-----------------

Enable-SPSessionStateService –DefaultProvision

This example enables a ASP.NET session state on a SharePoint Server 2013 farm that uses the defaults (database hosted on the configuration database SQL Server, using Windows authentication, 60-minute session time-out).

--------------EXAMPLE 2-----------------

Enable-SPSessionStateService –DatabaseName “SessionStateDatabase” –DatabaseServer “localhost” –SessionTimeout 120

This example enables a ASP.NET session state on a SharePoint Server 2013 farm that uses a custom database name, database server, session time-out of 120 minutes, and Windows credentials (due to the lack of a DatabaseCredentials parameter).

Change History

Date Description

July 16, 2012

Initial publication

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.