0

How do you set an IIS6 app pool's idle timeout with powershell? All I am seeing from my searches is how to set the app pool recycle time which isn't quite the same.

This is what is turning up, but I don't think it's what I am looking for:

$destinationPool.recycling.periodicRestart.schedule
TheWolf
  • 1,675
  • 4
  • 22
  • 34

2 Answers2

1

I can't test it but try this:

$ApplicationPool = Get-WmiObject -Class IISApplicationPoolSetting -Namespace "root/microsoftiisv2" | Where-Object {$_.Name -eq 'W3SVC/APPPOOLS/DefaultAppPool'}
$ApplicationPool.IdleTimeout=0
$ApplicationPool.Put()
CB.
  • 58,865
  • 9
  • 159
  • 159
  • Using the namespace "rootmicrosoftiisv2" threw an invalid namespace exception for me so I swapped that with "root\MicrosoftIISv2" and it executed without any exceptions; however the idle time was not changed. – TheWolf Oct 12 '12 at 23:07
  • Okay it works now, there was a typo in my test code which passed the incorrect app name. Thanks! – TheWolf Oct 12 '12 at 23:51
1

Using DSC (Desired State Configuration)

cAppPool $application.AppPool.Name 
{ 
    Name                    = $application.AppPool.Name                 
    AutoStart               = $application.AppPool.AutoStart            
    StartMode               = $application.AppPool.StartMode            
    ManagedRuntimeVersion   = $application.AppPool.ManagedRuntimeVersion
    ManagedPipelineMode     = $application.AppPool.ManagedPipelineMode  
    IdentityType            = $application.AppPool.IdentityType  
    LoadUserProfile         = $application.AppPool.LoadUserProfile
    Ensure                  = "Present" 
    idleTimeout             = "00:00:00"
}

The fact that idleTimeout was a string and not an int type tripped me up for a while. Trying to use "0" silently leaves it at the default of 20mins

(See cAppPool on GitHub)

fiat
  • 15,501
  • 9
  • 81
  • 103