'Script name : chk_services_v.vbs
dim strComputer
dim objWMIService
dim colServices,objService
dim errReturnCode
dim servicename
' 修改區 ========================
' 檢查的service name servicename = "Telnet"
'修改區結束=========================
'=====================================主程式
' 檢查service name
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServices = objWMIService.ExecQuery _
("Select * from Win32_Service where DisplayName = '" & servicename & "'")
For Each objService in colServices
if "Stopped" = objService.State then
msgbox "abc"
end if
Next
'==================================副程式
參考http://2mysite।net/blogview.asp?logID=376&cateID=7
沒有留言:
張貼留言