我正在尝试在 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是关于该主题的非常有帮助的页面
关于powershell - 如何使用 PowerShell 在 IIS 中设置 rapidFailProtectionInterval?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64722098/