2007年12月2日 星期日

檢查windows服務


'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

沒有留言:

RHEL install EPEL

  https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...