Restarting IIS from within a .vbs 
Author Message
 Restarting IIS from within a .vbs

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



Tue, 04 Feb 2003 03:00:00 GMT  
 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



Tue, 04 Feb 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. restart IIS and MTS from a script.

2. IIS Restart...

3. Restarting IIS

4. How to restart windows from within a script ?

5. How to restart windows from within a script ?

6. Howto update DLL without restarting IIS

7. how can i restart IIS programatically?

8. Running a .vbs script from within a .vbs script

9. Restart computer by vbs ?

10. windows restart with vbs

11. How to get Windows 98 to restart using VBS

12. Help Please, Need Code for Restarting WIN 95 within VB4 Application

 

 
Powered by phpBB® Forum Software