1

How do I set the recycling for a specific time for all of my current and future application pools in the IIS Manager.

I have tried to achieve this by going under Set Application Pool Defaults -> Recycling -> Specific Times, but this doesn't affect already created application pools.

Is there any way to achieve this - maybe with some kind of PowerShell script ?

user3369534
  • 125
  • 1
  • 7

1 Answers1

0

You could use below PowerShell script to set the application pool recycling time for all the application pool:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart" -name "time" -value "1.08:00:00"

using the command line:

appcmd.exe set config  -section:system.applicationHost/applicationPools /applicationPoolDefaults.recycling.periodicRestart.time:"1.08:00:00"  /commit:apphost

to set periodic restart value:

appcmd.exe set config  -section:system.applicationHost/applicationPools /+"applicationPoolDefaults.recycling.periodicRestart.schedule.[value='07:55:00']" /commit:apphost

command line:

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}
Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26