How do you change the SPWebApplication Web Page Security Validation timeout via PowerShell. I want to set this upon creating a web application during the creation of a farm, but I'm happy running a follow up script after creating the farm too.

You get to this in the GUI via Central Admin>Application Management>(select an app)>General Settings>Web Page Security Validation>Security validation expires after: ...

I can see the timeout setting in PowerShell using the scripts below, but I cannot set it that way. formDigestSettings is read only. You can leave off the '.Minutes' on the last line for more information about it.

$site = get-spsite 'https://....'

$webapp = $site.WebApplication


2 Answers 2


try this

$SPSite = Get-SPSite("[URL of site collection]")
$webApp = $SPSite.WebApplication
$webApp.FormDigestSettings.Enabled = $true
$webApp.FormDigestSettings.Expires = $true
$webApp.FormDigestSettings.Timeout = New-TimeSpan -Hours 1 -Minutes 20



I actually just answered it myself.

Change the last line by adding the specified time in this format:

$webapp.FormDigestSettings.Timeout = '00:15:00'

Then add another line:


You can then verify the change with:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.