如何使用 PowerShell 在 IIS 中设置 rapidFailProtectionInterval?
How do I set rapidFailProtectionInterval in IIS using PowerShell?
我正在尝试在 MS WSUS 设置上配置 WsusPool 的应用程序池,以使用 PowerShell 作为管理员将失败快速失败保护间隔从 5 分钟提高到 30 分钟。
我可以使用
获得设置
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
但是当我尝试保存对值的更改时出现错误
$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
系统部分数据:
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
你可以这样使用Set-WebConfigurationProperty
Set-WebConfigurationProperty '//*[@name="WsusPool"]//failure' -Name rapidFailProtectionInterval -Value (New-TimeSpan -Minutes 30)
Here 是关于该主题的非常有用的页面
我知道这已经得到解答,但我不得不进一步深入挖掘并发现这个 link,其中 Michael Felkin 为 IIS 提供了广泛的 属性 设置,我发现这非常棒。工藤他这样做...
You can find all that info here
这是我使用的较短版本:
$appPool = New-Item "IIS:\AppPools\MyAppPools" -Force
$appPool.failure.rapidFailProtection = "False"
$appPool | set-item
请记住,最后一行至关重要,以便设置更改。
希望有人会觉得有用! :)
我正在尝试在 MS WSUS 设置上配置 WsusPool 的应用程序池,以使用 PowerShell 作为管理员将失败快速失败保护间隔从 5 分钟提高到 30 分钟。
我可以使用
获得设置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
但是当我尝试保存对值的更改时出现错误
$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
系统部分数据:
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
你可以这样使用Set-WebConfigurationProperty
Set-WebConfigurationProperty '//*[@name="WsusPool"]//failure' -Name rapidFailProtectionInterval -Value (New-TimeSpan -Minutes 30)
Here 是关于该主题的非常有用的页面
我知道这已经得到解答,但我不得不进一步深入挖掘并发现这个 link,其中 Michael Felkin 为 IIS 提供了广泛的 属性 设置,我发现这非常棒。工藤他这样做...
You can find all that info here
这是我使用的较短版本:
$appPool = New-Item "IIS:\AppPools\MyAppPools" -Force
$appPool.failure.rapidFailProtection = "False"
$appPool | set-item
请记住,最后一行至关重要,以便设置更改。
希望有人会觉得有用! :)