【问题标题】:Set IIS Default App Pool Queue Length Powershell设置 IIS 默认应用程序池队列长度 Powershell
【发布时间】:2018-06-12 07:55:41
【问题描述】:

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

首先我运行

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

这给了我 queuelength 属性名称,然后我使用选择和提供值

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

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

谢谢

【问题讨论】:

    标签: powershell iis


    【解决方案1】:

    我可以使用 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
    

    【讨论】:

    • 谢谢,PSPath 似乎有所作为。谢谢 :)
    【解决方案2】:
    # 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
    }
    
    

    【讨论】:

      猜你喜欢
      • 2017-10-18
      • 1970-01-01
      • 2015-05-12
      • 2011-10-07
      • 2010-11-19
      • 1970-01-01
      • 2012-12-23
      • 2016-04-24
      • 1970-01-01
      相关资源
      最近更新 更多