Dennis
Dennis

Reputation: 1790

How do I set rapidFailProtectionInterval in IIS using PowerShell?

I'm trying to configure the Application Pool of WsusPool, on a MS WSUS setup, to raise the Failure Rapid-Fail Protection Interval from 5 minutes to 30 minutes as an administrator using PowerShell.

I'm able to get the setting using

Install-WindowsFeature Web-Mgmt-Console

Import-Module WebAdministration

$WsusPool = Get-Item IIS:\AppPools\WsusPool\
$WsusPool.failure.rapidFailProtectionInterval

Days              : 0
Hours             : 0
Minutes           : 5
Seconds           : 0
Milliseconds      : 0
Ticks             : 3000000000
TotalDays         : 0.00347222222222222
TotalHours        : 0.0833333333333333
TotalMinutes      : 5
TotalSeconds      : 300
TotalMilliseconds : 300000

But I get an error when I try save a change to the value

$WsusPool.failure.rapidFailProtectionInterval = New-TimeSpan -Minutes 30
$WsusPool | Set-Item

Set-Item : Specified cast is not valid.
At line:1 char:13
+ $WsusPool | Set-Item
+             ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Item], InvalidCastException
    + FullyQualifiedErrorId : path,Microsoft.PowerShell.Commands.SetItemCommand

Some data of the system:

Version of PowerShell:

PS C:\Windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  1490

Operating system:

PS C:\Windows\system32> Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, OSArchitecture, WindowsDirectory


Caption                 : Microsoft Windows Server 2019 Standard
Version                 : 10.0.17763
ServicePackMajorVersion : 0
OSArchitecture          : 64-bit
WindowsDirectory        : C:\Windows

Upvotes: 2

Views: 1620

Answers (2)

Vincy
Vincy

Reputation: 1078

I know this is already answered but I had to dig deep in further and found this link where Michael Felkin has put together extensive property settings for IIS which I found marvelous. Kudo to him for doing that...

You can find all that info here

Here is the shorter version of that I used:

$appPool = New-Item "IIS:\AppPools\MyAppPools" -Force
$appPool.failure.rapidFailProtection = "False"
$appPool | set-item

Keep in mind that the last line is crucial here in order to set the changes.

Hope, someone will find it helpful! :)

Upvotes: 1

Doug Maurer
Doug Maurer

Reputation: 8868

You can use Set-WebConfigurationProperty like this

Set-WebConfigurationProperty '//*[@name="WsusPool"]//failure' -Name rapidFailProtectionInterval -Value (New-TimeSpan -Minutes 30)

Here is a very helpful page on the subject

Upvotes: 4

Related Questions