k.a. Terminal Services,
discussed in Chapter 7) service is TermService.
So, to start the FTP service, you would type:
Result = Service("MSFTPSVC", True)
Object References | 537
Scripting and
Automation
or, to stop the service, you would type:
Result = Service("MSFTPSVC", False)
Either way, the function returns True (-1) if your action resulted in the service
being started, or False (0) if your action resulted in the service being
stopped. To simply query the service, without starting or stopping it, specify
(1) or any other positive number for Action, like this:
Result = Service("MSFTPSVC", 1)
Including this routine in your script would allow you to start and stop a service
with a single click (rather than having to wade through the Services window).
Or, using these script routines in conjunction with the Task Scheduler
(explained later in this chapter), for example, you could schedule your web
server service to operate only during certain hours of the day.
How to Write CGI Scripts for Web Servers
WSH scripts have the potential to produce simple, yet quite capable CGI
(Common Gateway Interface) applications: programs that are run by web
servers to generate dynamic web content. For example, a CGI program can
process data entered in web-based fill-out forms, or read data from files and
produce web content on the fly. Although a full discussion of web server
implementation and CGI programming is way beyond the scope of this
book, there are some extra steps and additional commands necessary to
write CGI programs with WSH scripts.
Pages:
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747