I have a .vbs script that will recycle an Application Pool on IIS 7 (Windows Server 2008) with no problems. You can run the script either manually, or using Task Scheduler. Here is the script:
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='AppPoolName'")
oAppPool.Recycle
When I try this script on IIS 8 I get an error:
Line: 3 (oAppPool.Recycle line)
Char: 1
Error: Access is denied
Code: 80070005
Source: SWbernObjectEx
It seems to be permissions releated, but I am an adminstrator on this machine, and running the script as an Administrator in a attempt to get it working.
My ultimate goal is to use this script in Task Scheduler to recycle the Application Pool when there is a .NET 1309 script error (in Event Veiwer) on the web site. This prevents the server from hanging until the error can be fixed.
Thanks.