SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 734 | Next

David A. Karp

"Windows Vista Annoyances: Tips, Secrets, and Hacks"


How to Manage Windows Services
Windows Vista Services, such as the IIS web server service, the FTP daemon
service, or the Remote Desktop service, can be managed with the Services
window (services.msc). Rudimentary service control is also possible with
WSH scripts. The following routine allows you to start and stop any service,
or just see whether a service is running:
Function Service(ServiceName, Action)
Const SERVICE_STOPPED = 1
Const SERVICE_RUNNING = 4
Set WshShell = WScript.CreateObject("WScript.Shell")
Set EnvObject = WshShell.Environment("PROCESS")
ComputerName = EnvObject("COMPUTERNAME")
Set ComputerObject = GetObject("WinNT://" & ComputerName & ",computer")
Set ServiceObject = ComputerObject.GetObject("Service",ServiceName)
If Action = True and ServiceObject.Status = SERVICE_STOPPED Then
ServiceObject.Start
ElseIf Action = 0 and ServiceObject.Status = SERVICE_RUNNING Then
ServiceObject.Stop
End If
If ServiceObject.Status = SERVICE_RUNNING Then
Service = True
Else
Service = False
End If
End Function
This general-purpose routine accepts two parameters: ServiceName and
Action. ServiceName is a single word that represents the service you wish to
control, and Action is either True to start the service, False to stop it, or (1)
to see whether it??™s running or not. To find the service name for a given service,
open the Services window (services.msc) and double-click the service in
question. The name is listed at the top of the General tab; for example, the
service name for the IIS service is IISADMIN, the name for the FTP service is
MSFTPSVC, and the name for the Remote Desktop (a.


Pages:
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6