濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > VBScript之通過對(duì)比注冊(cè)表查找隱藏的服務(wù)

VBScript之通過對(duì)比注冊(cè)表查找隱藏的服務(wù)

熱門標(biāo)簽:東營快遞外呼系統(tǒng) 除了地圖標(biāo)注還有這種生意嗎 地圖標(biāo)注政府哪個(gè)部門管 哪里有便宜的地圖標(biāo)注公司 神行者美術(shù)館地圖標(biāo)注 百度地圖標(biāo)注點(diǎn)距離代碼 如何用機(jī)器人進(jìn)行電銷 齊齊哈爾高德地圖標(biāo)注店 佛山真人電銷機(jī)器人廠家
效果圖:



代碼(checksvr.vbs):

復(fù)制代碼 代碼如下:

'On Error Resume Next

Const HKEY_LOCAL_MACHINE = H80000002

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Services"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

Wscript.Echo "Checking, please wait ..."
Wscript.Echo ""

For Each subkey In arrSubKeys
 oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath "\\" subkey, "ObjectName", strValue

 If Not (strValue = "") Then
  '判斷服務(wù), 利用數(shù)組來比較不知道會(huì)不會(huì)快些?
  If Not (CheckSvr(subkey)) Then
   Wscript.Echo subkey FormatOutTab(subkey) strValue FormatOutTab(strValue) "[ Hidden ]"
  Else 
   Wscript.Echo subkey FormatOutTab(subkey) strValue FormatOutTab(strValue) "[   OK   ]"
  End If

 End If
Next
Wscript.Echo ""
Wscript.Echo "All done."
Wscript.Quit (0)

 

Function CheckSvr(strName)
 Set oWMI = GetObject("winmgmts:" "{impersonationLevel=impersonate}!\\.\root\cimv2")
 Set cService = oWMI.ExecQuery("Select * from Win32_Service WHERE Name='" strName "'")
 If (cService.count > 0) Then
  CheckSvr = True
 Else
  CheckSvr = False
 End If
End Function

Function FormatOutTab(strName)
 strLen = Len(strName)
 Select Case True
  Case strLen 8
   FormatOutTab =  vbTab vbTab vbTab vbTab vbTab

  Case strLen 16
   FormatOutTab =  vbTab vbTab vbTab vbTab

  Case strLen 24
   FormatOutTab =  vbTab vbTab vbTab

  Case strLen 32
   FormatOutTab =  vbTab vbTab

  Case strLen 40
   FormatOutTab =  vbTab

  Case Else
   FormatOutTab =  vbTab
  End Select
End Function

利用字典,速度要快很多:

復(fù)制代碼 代碼如下:

Dim oDic, oReg, oWmi, arrServices
Const HKEY_LOCAL_MACHINE = H80000002

Wscript.Echo "[*] Checking, please wait ..."
Wscript.Echo ""

Set oDic = CreateObject("Scripting.Dictionary")

Set oWmi = GetObject("winmgmts:" "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set arrServices = oWmi.ExecQuery("Select * from Win32_Service")
For Each strService In arrServices
 oDic.Add strService.Name, strService.Name
Next

Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
 oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath "\\" subkey, "ObjectName", strValue
 If Not (strValue = "") Then
  If oDic.Exists(subkey) Then
   Wscript.Echo subkey FormatOutTab(subkey) strValue FormatOutTab(strValue) "[   OK   ]"
  Else 
   Wscript.Echo subkey FormatOutTab(subkey) strValue FormatOutTab(strValue) "[ Hidden ]"
  End If
 End If
Next

oDic.RemoveAll

Wscript.Echo ""
Wscript.Echo "[*] All done."
Wscript.Quit (0)


Function FormatOutTab(strName)
 strLen = Len(strName)
 Select Case True
  Case strLen 8
   FormatOutTab =  vbTab vbTab vbTab vbTab

  Case strLen 16
   FormatOutTab =  vbTab vbTab vbTab

  Case strLen 24
   FormatOutTab =  vbTab vbTab

  Case strLen 32
   FormatOutTab =  vbTab

  Case Else
   FormatOutTab =  vbTab
  End Select
End Function



來自: enun.net

標(biāo)簽:鶴壁 四平 銅川 西安 湖州 文山 邢臺(tái) 巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《VBScript之通過對(duì)比注冊(cè)表查找隱藏的服務(wù)》,本文關(guān)鍵詞  VBScript,之,通過,對(duì)比,注冊(cè)表,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。

  • 相關(guān)文章
  • 下面列出與本文章《VBScript之通過對(duì)比注冊(cè)表查找隱藏的服務(wù)》相關(guān)的同類信息!
  • 本頁收集關(guān)于VBScript之通過對(duì)比注冊(cè)表查找隱藏的服務(wù)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    遂宁市| 石柱| 夏津县| 临沧市| 东明县| 杨浦区| 宾川县| 荔浦县| 旌德县| 防城港市| 宁国市| 青铜峡市| 开阳县| 蒲城县| 深州市| 安吉县| 纳雍县| 扎鲁特旗| 依安县| 怀宁县| 渝北区| 辉县市| 高淳县| 太仆寺旗| 扬州市| 宁晋县| 华阴市| 麻江县| 玉山县| 孝义市| 双牌县| 禄劝| 宁都县| 河西区| 灯塔市| 新丰县| 略阳县| 安国市| 社会| 阿拉善盟| 邮箱|