Norrin Rad
Norrin Rad

Reputation: 991

Set IIS Default App Pool Queue Length Powershell

I'm trying to set the IIS settings programmatically, I've managed to get most of them done.

firstly I run

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

This gives me the queuelength property name, then I select and supply value using

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

However this doesn't change the setting for the IIS Default app pool, Any ideas where I'm going wrong :(

Thanks

Upvotes: 1

Views: 2951

Answers (3)

seagulledge
seagulledge

Reputation: 344

Here's how to disable the recycling timer using powershell:

Import-Module WebAdministration
$defaultAppPool = Get-ItemProperty IIS:\AppPools\DefaultAppPool
Set-ItemProperty -Path $defaultAppPool.PSPath -Name Recycling.periodicRestart.time -Value New-TimeSpan

Upvotes: 0

greg
greg

Reputation: 117

# 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
}

Upvotes: -1

Ketanbhut
Ketanbhut

Reputation: 506

I was able to do it using 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

Output:

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

Upvotes: 3

Related Questions