-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache_stop.vbs
25 lines (20 loc) · 893 Bytes
/
apache_stop.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
':#######################################################################
':# File name: server_stop.vbs
':#######################################################################
option explicit ' force all variables to be declared
Dim wmiService, processList, currProcess, retCode, productName
productName = "PortApache 2.2.11"
Set wmiService = GetObject ("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set processList = wmiService.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'httpd.exe'")
If processList.Count = 0 Then
WSCript.Echo "The " & productName & " process is not running"
WScript.Quit
End If
For Each currProcess in processList
retCode = currProcess.Terminate()
If retCode <> 0 Then
Wscript.Echo "Could not kill process. Error code: " & retCode
End If
Next
WSCript.Echo "The " & productName & " process has been terminated"
WScript.Quit