Set Shell = WScript.CreateObject("WScript.Shell")
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
WINDIR = LCase(fso.GetSpecialFolder(0))
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where StartMode = 'Disabled' or StartMode = 'Manual'")
For Each objService in colServiceList
svcName = objService.Name
svcPath = LCase(objService.PathName)
If InStr(svcPath, "system32\svchost")>0 Then
svcDLL = Shell.RegRead("HKLM\SYSTEM\CurrentControlSet\Services\" & svcName & "\Parameters\ServiceDll")
svcDLL = LCase(svcDLL)
svcDLL = replace(svcDLL, "%windir%", WINDIR)
svcDLL = replace(svcDLL, "%systemroot%", WINDIR)
If Not fso.FileExists(svcDLL) Then
wscript.stdout.writeline(svcName & " " & svcDLL)
End If
Else
If Left(svcPath,1)="""" Then
svcPath = Mid(svcPath, 2, InStr(2, svcPath, """")-2)
Else
If InStr(svcPath, " ")>0 Then svcPath = Left(svcPath, InStr(svcPath, " "))
End if
If Not fso.FileExists(svcPath) Then
wscript.stdout.writeline(svcName & " " & svcPath)
End If
End If
Next
阅读(1326) | 评论(0) | 转发(0) |