[dba-Tech] Control IIS From a .BAT file

Drew Wutka dbatech at wolfwares.com
Sat Aug 30 23:12:27 CDT 2003


I've seen other posts about this, using the net stop and net start commands,
with the w2svc service.  I have a few comments.

First, the services for an NT based machine can also be stopped/started from
another computer.  Here's an example:

cscript service.vbs /X /N W3SVC /S YourWebServer
pause

cscript service.vbs /G /N W3SVC /S YourWebServer

The service.vbs script is part of the Microsoft Windows 2000 Resource kit
(and probably is included in other versions).  This is an EXTREMELY handy
thing to have.  (If you REALLY need it, let me know, I can email it to you
(the script, not the kit).

Also, most recently I ran into iisreset.  That's a little program you can
run, which will restart your IIS 'server' (everything with IIS, not the
machine itself).  What's REALLY fantastic about this utility, is that it can
even be used when you have gotten caught in a continuous loop.  I write a
lot of .asp stuff, that use VB .dll's.  Most of the time, I have a Class
that builds a collection of individual classes, which are filled from a
recordset.  Once in a while, I forget to put the rs.movenext line, in the
loop, so the loop just keeps filling the collection with the same data, over
and over.  It will technically run forever, and REALLY bogs down the IIS
server.  Up until I discovered the iisreset command, I had to reboot the
server itself, to get everything to stop.

A tip on that, the iisreset can be run with the Resource Kit utility
exec.vbs (which lets you run a program on a remote machine).

Drew

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com]On Behalf Of Bryan
Carbonnell
Sent: Thursday, August 28, 2003 6:39 PM
To: dba-tech at databaseadvisors.com
Subject: [dba-Tech] Control IIS From a .BAT file


Is it possible to start and stop IIS froma .bat file?

What I am trying to do is be able to stop Apache and start IIS from
one .bat file and from another stop IIS and start Apache.

I know the Apache commands, but I don't know the IIS commands.

Any takers?

--
Bryan Carbonnell - carbonnb at sympatico.ca
There are two ways to write bug-free code; only the third way works.


_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list