Quantcast
Viewing all articles
Browse latest Browse all 26542

Permission denied when recycling Application Pool via .vbs script IIS 8

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.


Viewing all articles
Browse latest Browse all 26542


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>