Created
January 18, 2011 01:57
-
-
Save jstangroome/783869 to your computer and use it in GitHub Desktop.
Configure TFS notification delays
This file contains 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
#requires -version 2.0 | |
param ( | |
[parameter(Mandatory=$true)] | |
[string] | |
$Url, | |
[ValidateRange(0, 86400)] | |
[int] | |
$DelaySeconds = 120 | |
) | |
$ErrorActionPreference = 'Stop' | |
Set-StrictMode -Version Latest | |
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' | |
$DefaultPath = '/Configuration/JobService/DefaultDelayedJobDelay' | |
$Path = '/Service/Integration/Settings/NotificationJobDelay' | |
$Connection = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $Url | |
#$Connection = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsConfigurationServer -ArgumentList $Url | |
$Connection.EnsureAuthenticated() | |
$Registry = $Connection.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry]) | |
$OldDelaySeconds = 120 | |
$DefaultDelay = $Registry.GetValue($DefaultPath, $OldDelaySeconds) | |
$OldDelaySeconds = $Registry.GetValue($Path, $OldDelaySeconds) | |
if ($OldDelaySeconds -ne $DelaySeconds) { | |
"Changing notification job delay from $OldDelaySeconds seconds to $DelaySeconds seconds." | |
'The TFS web application must restart for this change to take effect.' | |
$Registry.SetValue($Path, $DelaySeconds) | |
} else { | |
"Notification job delay already set to $OldDelaySeconds seconds." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment