首页 > 解决方案 > 设置 IIS 默认应用程序池队列长度 Powershell

问题描述

我正在尝试以编程方式设置 IIS 设置,我已经设法完成了大部分设置。

首先我跑

Get-ItemProperty IIS:/AppPools\DefaultAppPool | Select *

这给了我 queuelength 属性名称,然后我使用

 Set-ItemProperty IIS:/AppPools\DefaultAppPool -Name QueueLength -Value 5000

但是,这不会更改 IIS 默认应用程序池的设置,任何我出错的想法:(

谢谢

标签: powershelliis

解决方案


我能够使用 PSPath 做到这一点

Import-Module WebAdministration
$defaultAppPool = Get-ItemProperty IIS:\AppPools\DefaultAppPool

#$defaultAppPool.PSPath

Write-Host "Display Queue Length before change: " -NoNewline
(Get-ItemProperty IIS:\AppPools\DefaultAppPool\).queueLength

#Value changed here
Set-ItemProperty -Path $defaultAppPool.PSPath -Name queueLength -Value 5000

Write-Host "Display Queue Length after change: " -NoNewline
(Get-ItemProperty IIS:\AppPools\DefaultAppPool\).queueLength

输出:

Display Queue Length before change: 4000
Display Queue Length after change: 5000

推荐阅读