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:
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.
"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
Keev
2 Posts
Setting Recycling->Specific Times for application pools
Nov 23, 2010 11:11 AM|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
RafaMarrara
4 Posts
Re: Setting Recycling->Specific Times for application pools
Nov 28, 2010 09:02 PM|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
Craig Celest...
2 Posts
Re: Setting Recycling->Specific Times for application pools
Mar 30, 2011 07:53 PM|LINK
HCamper
8048 Posts
Re: Setting Recycling->Specific Times for application pools
Mar 30, 2011 08:19 PM|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
Community Member Award 2011
Keev
2 Posts
Re: Setting Recycling->Specific Times for application pools
Apr 03, 2011 05:25 PM|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.
webguynj
55 Posts
Re: Setting Recycling->Specific Time for application pools
Jun 10, 2011 12:26 PM|LINK
On a similar note,
Howdo set up an Application Pool to recycle at a specific time of the day using PowerShell?
hx716
1 Post
Re: Setting Recycling->Specific Times for application pools
Feb 29, 2012 02:31 PM|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