我正在尝试以编程方式设置IIS设置,我已设法完成大部分工作。
首先我跑
Get-ItemProperty IIS:/AppPools\DefaultAppPool | Select *
这给了我queuelength属性名,然后我选择并使用
提供值 Set-ItemProperty IIS:/AppPools\DefaultAppPool -Name QueueLength -Value 5000
但是,这不会改变IIS默认应用程序池的设置,任何我出错的想法:(
由于
答案 0 :(得分:1)
我能够使用PSPath
来做到这一点.no-leaf-style
输出:
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
答案 1 :(得分:-1)
# change all queueLength for app polls on IIS
Import-Module WebAdministration
$allPolls = Get-IISAppPool
$newqueueLength = 10000
$defaultAppPool = ""
Foreach ($item in $allPolls)
{
$pollname = $item.Name
#Write-Host "Queue Length before change: " -NoNewline
#Write-Host $pollname
$defaultAppPool = Get-ItemProperty "IIS:\AppPools\$pollname"
#(Get-ItemProperty "IIS:\AppPools\$pollname\").queueLength
Set-ItemProperty -Path $defaultAppPool.PSPath -Name queueLength -Value $newqueueLength
}