Forked from janikvonrotz/Update-SPTokenLifetime.ps1
Created
September 22, 2016 15:21
-
-
Save akhileshnirapure/06af99cdee6ba4b1bffbc81d5c29c2cb to your computer and use it in GitHub Desktop.
PowerShell: Update SharePoint Token Lifetime
#SharePoint
#PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"} | |
# update SharePoint cache token lifetime | |
$SPContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService | |
$SPContentService.TokenTimeout = (New-TimeSpan -minutes 5) | |
$SPContentService.Update() | |
# udpate SharePoint claims token lifetime | |
$SPSecurityTokenServiceConfig = Get-SPSecurityTokenServiceConfig | |
$SPSecurityTokenServiceConfig.WindowsTokenLifetime = (New-TimeSpan –minutes 5) | |
$SPSecurityTokenServiceConfig.FormsTokenLifetime = (New-TimeSpan -minutes 5) | |
# if you happen to set a lifetime that is shorter than the expiration window user will be blocked from accessing the site. | |
$SPSecurityTokenServiceConfig.LogonTokenCacheExpirationWindow = (New-TimeSpan -minutes 4) | |
$SPSecurityTokenServiceConfig.Update() | |
iisreset.exe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment