Why isn't my scheduled task working?

gib88

Baseband Member
Messages
94
Location
Canada
Hello,

I'm trying to schedule a task in the Task Scheduler on Windows Server 2016. The task is to reset a website in IIS. It's supposed to run every 5 minutes.

Here is the action:

"appcmd.exe" start site /site.name: Default Web Site

This keeps giving me a 0x57 error.

I know that this works because I've verified it:

"appcmd.exe" start site /site.name:testsite

Therefore, it seems to me that the problem is with Default Web Site. I'm guessing appcmd doesn't know how to handle the spaces in the name. I tried this but this doesn't work either:

"appcmd.exe" start site /site.name:"Default Web Site"

Does anyone know how I would set the website to be restarted as the Default Web Site? Thanks.
 
You might want to try putting escape characters in from of the spaces.
Code:
appcmd.exe start site /site.name:Default\ Web\ Site
 
Back
Top Bottom