Archive: Stop and Start Website on IIS


Stop and Start Website on IIS
I am trying to stop and start the website for my web service so that after the install the correct version is running on IIS.


cscript %WinDir%\System32\iisweb.vbs /stop "%WebServer%"


cscript %WinDir%\System32\iisweb.vbs /start "%WebServer%"

there might be another way but if you want to stop one web server this is it


Thank your for helping, this worked


Rather start and stop the web server you may find it better to start and stop teh site

http://www.microsoft.com/technet/pro....mspx?mfr=true

For IIS 6.0


The code I sent him does stop the site.

There may be other ways for sure but that's what that does.


I was just pointing out that that will stop the web server service rather than a specfic site which the OP indicted he needed.


Ok I am having problems running this inside of the installer in cmd prompt this works

iisweb /stop WebService

code in nullsoft is

ExecWait '"cscript" iisweb.vbs /stop WebService'

ive also tried

ExecWait '"cscript" %WinDir%\System32\iisweb.vbs /stop "WebService"'

any help is appreciated


Ok I have changed the code to

PUSH $R0
ReadEnvStr $R0 "COMSPEC"
ExecWait '$R0 /C "iisweb.vbs /stop WebService"'

but when i put

ExecWait '$R0 /C cscript "iisweb.vbs /stop WebService"'

it does not work correctly


Try:
ExecWait '"$R0" /C cscript iisweb.vbs /stop WebService'

Also if you use /K instead of /C the command window will stay open so you can see any issues.

Stu


hey Afrow,

with ExecWait '"$R0" /C cscript iisweb.vbs /stop WebService'

the command window does not even open


ExecWait '$R0 /K cscript "iisweb.vbs /stop WebService"'

Ok the error i receive with this is

Input Error: There is no file extension in C:\iisweb.vbs \stop WebService


Originally posted by whourdady
hey Afrow,

with ExecWait '"$R0" /C cscript iisweb.vbs /stop WebService'

the command window does not even open
It probably does but disappears before you see it. You need those quotes in case the path to cmd.exe contains spaces (it never should but you never know). Does using a full path to the VBS (in quotes) work?

e.g.
ExecWait `"$R0" /C cscript "C:\some\iisweb.vbs" /stop WebService`
Edit: Everything after the /C is what you'd type in command prompt itself. If it doesn't work in command prompt then don't expect it to work on the command line either.

Stu

you are right, I just got it working as you posted it.

ExecWait '$R0 /C cscript "%WinDir%\System32\iisweb.vbs" /stop WebService'

I could not have gotten this without your help thanks Afrow UK


You should use $SYSDIR\iisweb.vbs rather than that path.

Stu