WinServ [v1.0]

Author: Hardeep Last Modified: nonexistent


WinServ function can be used to start, stop or query(running status) a windows service on local or a remote computer. Dialogs provide visual feedback when starting/stopping a service or when an error occurs. Usage documentation is included in the library.

WinServ(ServiceName, Task="", Silent=False, Computer="")
WinServ_ErrMsg(Title, ServiceName, Task="", Silent=False, Dummy="")

For the functions's parameters and return value, please see it's source code.

Remarks

It is not stdlib conform, because global variables are in use.

This library lacks an external documentation, but every function is detailed described in the souce.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=21975

License

The functions is an open source item under the Public Domain license.
For details, please see Hardeep_WinServ-license.txt

Example

; #Include WinServ.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

;Start the Task Scheduler service by using its Service Name
MsgBox % WinServ("Schedule", True) ;Returns True if started successfully.

; More Examples:
/*
;Start the Task Scheduler service by using its Service Name
WinServ("Schedule", True) ;Returns True if started successfully.

;Stop the Task Scheduler service by using its Display Name
WinServ("Task Scheduler", False) ;Returns True if stopped successfully.

;Start the Windows Time service silently
WinServ("Windows time", True, True) ;No popups

;Start the Task Scheduler service on remote computer name ZOMBIE
WinServ("Schedule", True, False, "ZOMBIE") ;Returns True if started successfully.

;Check if the WebClient service is running
If WinServ("WebClient")
{   MsgBox, WebClient is up & running
   ;Do Something
}

;Toggle the DNS Client service
WinServ("DNS Client", WinServ("DNS Client") ? False : True)
*/