
Restarting IIS from within a .vbs
Call cmd.exe from your shell.
Do this:
iReturn = Shell("cmd /c net stop iisadmin /y")
...check iReturn for errors 0=SUCCESS...
iReturn = Shell("cmd /c mtxstop")
iReturn = Shell("net start w3svc")
You can also create a batch file to do this just as
easy.
Also, if you're writing a VB COM object anyhow, you might
consider hooking into Win32 API (advapi32.dll) and using the
ControlService function to send a stop command.
You could also use WMI to stop it.
Both are more elegant than shelling out to stop the services.
-Chad
Quote:
> I am trying to find a way to restart IIS and MTS from a script.
> In essence I want to achieve these command line commands:
> net stop iisadmin /y
> mtxstop
> net start w3svc
> I tried using the SHELL command from a COM wrapper to execute a batch file
> containg the above commands. No luck SHELL only executes executables!!
> What I really need is access to the services so I can stop and start the
> relevant services vial a COM interface.
> Can anybody help?
> Tasha