Nope! Looks interesting but I do want the powershell stuff to work. It worked just fine in powershell 1 on a Windows 2003 Server so I see no reason to why it should not work now.
You have created a pool and assign the object to a specific powershell variable.
Even though you have changed any attribute of the variable, that does not affect the actual apppool object and that is currenly by design. And that can be solved with using Set-ItemProperty as the following:
If you run the above commands, you will see there is a new apppool named "test3" and the periodicrestart and the idletimeout of the apppool is set to 0.
mtanneryd
11 Posts
Setting recycle and process model properties on app pool from powershell
May 13, 2010 09:38 AM|LINK
Hi!
I'm creating an app pool from powershell using the following:
$pool = New-WebAppPool -Name $name
$pool.recycling.periodicrestart.time = [TimeSpan]::FromMinutes(0)
$pool.processModel.idleTimeout = [TimeSpan]::FromMinutes(0)
The app pool is created but it ignores my values for recycling.periodicrestart.time and processModel.idleTimeout.
What am I doing wrong here? I'm using a Windows Server 2008 R2 x64 Web Edition and Powershell 2.
/Måns
marcoshaw
47 Posts
Re: Setting recycle and process model properties on app pool from powershell
May 18, 2010 03:57 AM|LINK
Just for fun, have you tried setting this via the IIS:\ provider?
http://learn.iis.net/page.aspx/688/using-the-iis-application-warm-up-module/
mtanneryd
11 Posts
Re: Setting recycle and process model properties on app pool from powershell
May 18, 2010 05:15 AM|LINK
Nope! Looks interesting but I do want the powershell stuff to work. It worked just fine in powershell 1 on a Windows 2003 Server so I see no reason to why it should not work now.
JeongHwan
52 Posts
Microsoft
Moderator
Re: Setting recycle and process model properties on app pool from powershell
Jun 02, 2010 05:40 PM|LINK
Hi,
You have created a pool and assign the object to a specific powershell variable.
Even though you have changed any attribute of the variable, that does not affect the actual apppool object and that is currenly by design. And that can be solved with using Set-ItemProperty as the following:
$name = "test3"
$pool = New-WebAppPool -Name $name
$pool.recycling.periodicrestart.time = [TimeSpan]::FromMinutes(0)
$pool.processModel.idleTimeout = [TimeSpan]::FromMinutes(0)
Set-ItemProperty ("IIS:\AppPools\"+$name) -Name recycling.periodicrestart.time $pool.recycling.periodicrestart.time
Set-ItemProperty ("IIS:\AppPools\"+$name) -Name processModel.idleTimeout $pool.processModel.idleTimeout
Get-ItemProperty ("IIS:\AppPools\"+$name) -Name recycling.periodicrestart.time.value
Get-ItemProperty ("IIS:\AppPools\"+$name) -Name processModel.idleTimeout.value
If you run the above commands, you will see there is a new apppool named "test3" and the periodicrestart and the idletimeout of the apppool is set to 0.