简体   繁体   English

如何使用 PowerShell 在 IIS 中设置 RapidFailProtectionInterval?

[英]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.我正在尝试在 MS WSUS 设置上配置 WsusPool 的应用程序池,以使用 PowerShell 作为管理员将故障快速故障保护间隔从 5 分钟提高到 30 分钟。

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

You can use Set-WebConfigurationProperty like this您可以像这样使用Set-WebConfigurationProperty

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

Here is a very helpful page on the subject 是有关该主题的非常有用的页面

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.我知道这已经得到了回答,但我不得不进一步深入挖掘并找到了这个链接,其中 Michael Felkin 为 IIS 整合了广泛的属性设置,我发现这很棒。 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!希望,有人会发现它有帮助! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用PowerShell使用增量值设置一组IIS网站的绑定端口号? - How do I set the binding port number for a set of IIS websites with an increment value using PowerShell? 如何在 IIS 管理器中使用 PowerShell 或 appcmd 在 Compression 中设置应用程序池磁盘空间限制? - How do I set the application pool disk space limit in IIS Manager in Compression using PowerShell or appcmd? 如何使用 Powershell 删除 IIS 自定义标头? - How do I remove IIS custom header using Powershell? 如何使用 Powershell 在 IIS 中设置“ConnectAs”用户 - How to set "ConnectAs" user in IIS using Powershell 如何使用Powershell在IIS 5.0中创建应用程序? - How do I create an application in IIS 5.0 using powershell? 如何在IIS中运行PowerShell脚本? - How do I run a PowerShell script “in” IIS? 如何使用Powershell回收IIS AppPool? - How do I recycle an IIS AppPool with Powershell? 如何使用 powershell 设置 IIS 的表单身份验证 (system.web/authentication) 的 overrideMode? - How do I set overrideMode of Forms Authentication (system.web/authentication) of IIS with powershell? 如何通过Powershell脚本设置IIS 10.0管理服务SSL证书以允许Web部署? - How do I set the IIS 10.0 Management Service SSL Certificate via a Powershell script to allow Web Deploy? 如何在Powershell中设置IIS7.5 FTP站点的授权? - How do I set the authorization of an IIS7.5 FTP site in powershell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM