How To Set the Daily Time Window for Large Queries Settings in PowerShell

 

Here’s a quick script to set the “Daily Time Window for Large Queries” for all the web applications in a SharePoint 2010 farm via Windows PowerShell.

image

#The start hour in the default time zone or in the local time zone. If the DefaultTimeZone property for the Web application is set,
#the hour refers to the default time zone; otherwise, hour refers to the local current time zone. Valid values are 00-23 (12am - 11pm)
$hour = "20"

#The start minute in the default time zone or the local time zone. Valid values 00, 15, 30, 45
$minute = "00"

#The window duration in hours. Valid values are 0-24
$duration = "4"

Get-SPWebApplication | % { $_.UnthrottledPrivilegedOperationWindowEnabled = $true; $_.SetDailyUnthrottledPrivilegedOperationWindow($hour, $minute, $duration); $_.Update() }