Setting Recycling->Specific Times for application pools [Answered]RSS

6 replies

Last post Feb 29, 2012 10:31 AM by hx716

  • Setting Recycling->Specific Times for application pools

    Nov 23, 2010 07:11 AM|Keev|LINK

    Hi

    I am trying to set up a series of application pool properties using a PS script. However, one of the properties, Recycling -> Specific Times causes some problems. I have tried several approaches, but I can’t seem to get it set.

    The following snippet is accepted with no errors, but the change is not registered:

    Set-ItemProperty IIS:\AppPools\[poolName] -Name Recycling.PeriodicRestart.Schedule -Value (New-TimeSpan -h 22 -m 00)


    The same applies if I replace the specified TimeSpan value with “22:00:00” or [TimeSpan] “22:00:00”.

    I have also tried the below snippet which has no effect either:

    [TimeSpan[]] $x = ((New-TimeSpan -h 22 -m 00))Set-ItemProperty IIS:\AppPools\CrmDashboards -Name Recycling.PeriodicRestart.Schedule -Value $x


    Does anyone have a hint to what I am doing wrong? Thanks!

    Recycling TimeSpan Specific Times

  • Re: Setting Recycling->Specific Times for application pools

    Nov 28, 2010 05:02 PM|RafaMarrara|LINK

    Keev,

     

    I was doing this today, but to the "applicationPoolDefaults" and it works fine for me.

    Maybe it will help you.
     

    # clean all scheduled recycles 

    Clear-WebConfiguration /system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule

     

    # add periodic recycle (1h30)

    add-webconfiguration /system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule -value (New-TimeSpan -h 1 -m 30)

     

    # check if the recycle was added

    get-webconfiguration /system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule/add | select value

     

    Hope that I'm helping.

    Regards

    PowerShell Recycling applicationPoolDefaults periodicRestart

    Rafael Marrara
  • Re: Setting Recycling->Specific Times for application pools

    Mar 30, 2011 03:53 PM|Craig Celeste|LINK

    Did you figure out how to do this? I am struggling with the same issues.
  • Re: Setting Recycling->Specific Times for application pools

    Mar 30, 2011 04:19 PM|HCamper|LINK

    Hello @ Craig,

    As you may have noticed this is an old thread and the user has answer for the specific Issue.

    It is very likey the User will not be following this Thread to provide an answer.

    I might be best to open a new Post in the Trouble Shooting  or Administration Forum

     with the details for Your System and the Issues your having.

    You could also look at the current suggested settings in the IIS Net library here http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/add/recycling .

    The best way to get answers for problems is with creating a post & question.

    Thank you for understanding,

    Martin

     

     

    Windows and Linux work Together IT-Pros
    Community Member Award 2011
  • Re: Setting Recycling->Specific Times for application pools

    Apr 03, 2011 01:25 PM|Keev|LINK

     Hi,

     Sorry for the very late answer and thank you for the suggestion. Unfortunately, I tried the suggested approach on "applicationPoolDefault" where it works, but for other app pools there is no luck. It seems it only works when changing defaults. I ended up using appcmd instead, it does the trick with no problems.

  • Re: Setting Recycling->Specific Time for application pools

    Jun 10, 2011 08:26 AM|webguynj|LINK

    On a similar note,

    Howdo set up an Application Pool to recycle at a specific time of the day using PowerShell?

  • Re: Setting Recycling->Specific Times for application pools

    Feb 29, 2012 10:31 AM|hx716|LINK

    "applicationPoolDefault" will set the default values for the new app pools to be created afterwords. To create a value for a specific AppPool you can the following:

    clear-ItemProperty IIS:\AppPools\MyPoolName -Name Recycling.periodicRestart.schedule #clear the existing values
    set-ItemProperty IIS:\AppPools\MyAppPoolName -Name Recycling.periodicRestart.schedule -Value @{value="03:00:00"} #to set it to 3 AM

     

    iis7 powershell snap-in AppPool