欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用vbs腳本來(lái)監(jiān)控windows服務(wù)器上的應(yīng)用程序(不存在就啟動(dòng))

 更新時(shí)間:2024年04月14日 22:07:54   作者:SYSCTO  
這個(gè)vbs代碼主要實(shí)現(xiàn)的功能就是運(yùn)行該程序,就會(huì)在進(jìn)程中出現(xiàn)一個(gè)wscript.exe?它會(huì)每隔10s掃面一次進(jìn)程中是否存在notepad.exe這個(gè)程序,不存在就啟動(dòng)。這個(gè)啟動(dòng)程序可能跟進(jìn)程名不一樣,好比tomcat應(yīng)用,啟動(dòng)的是startup.bat,后臺(tái)進(jìn)程名為java.exe

這個(gè)vbs代碼主要實(shí)現(xiàn)的功能就是運(yùn)行該程序,就會(huì)在進(jìn)程中出現(xiàn)一個(gè)wscript.exe 它會(huì)每隔10s掃面一次進(jìn)程中是否存在notepad.exe這個(gè)程序,不存在就啟動(dòng)。這個(gè)啟動(dòng)程序可能跟進(jìn)程名不一樣,好比tomcat應(yīng)用,啟動(dòng)的是startup.bat,后臺(tái)進(jìn)程名為java.exe,這樣就需要調(diào)整代碼proname="java.exe"

關(guān)于如果關(guān)掉監(jiān)控 可以在運(yùn)行下執(zhí)行taskkill /f /im wscript.exe 或者在任務(wù)管理器 進(jìn)程中找到wscript.exe 結(jié)束進(jìn)程就可以了

調(diào)整WshShell.Run("startup.bat")

核心代碼

dim wmi,proc,procs,proname,flag,WshShell
Do
proname="notepadjb51.exe" '需要監(jiān)測(cè)的服務(wù)進(jìn)程的名稱,自行替換這里的記事本進(jìn)程名
set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\.rootcimv2")
set procs=wmi.execquery("select * from win32_process")
flag=true
for each proc in procs
if strcomp(proc.name,proname)=0 then
flag=false
exit for
end if
next
set wmi=nothing
if flag then
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run ("notepadjb51.exe")
end if
wscript.sleep 10000 '檢測(cè)間隔時(shí)

VBS寫個(gè)小腳本 實(shí)時(shí)監(jiān)測(cè)指定程序是否運(yùn)行 對(duì)運(yùn)行的軟件進(jìn)行操作 最后關(guān)閉運(yùn)行軟件

strComputer = "."
Set objShell = CreateObject("Wscript.Shell") 
do
Set wbemServices = Getobject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_process")
For Each wbemObject In wbemObjectSet
if wbemObject.name="QQ.exe" then
  WScript.Sleep 1000
  objShell.SendKeys "{F12}"
  WScript.Sleep 1000
  objShell.SendKeys "{ENTER}"
  dim WSHshell 
  set WSHshell = wscript.createobject("wscript.shell") 
  WSHshell.run "taskkill /im wscript.exe /f ",0 ,true 
end if
Next
loop

批處理檢測(cè)進(jìn)程是否存在;這個(gè)我用來(lái)檢測(cè)文化進(jìn)程是否存在,因?yàn)槭蔷G色版的,很容易被關(guān)閉,所以需要檢測(cè)。

tasklist /nh|find /i "ClientOfWatcher.exe"
if ERRORLEVEL 1 (start C:\watcher\ClientOfWatcher.exe) else (exit)

VBS定時(shí)檢測(cè)進(jìn)程是否存在,如果不存在就啟動(dòng)進(jìn)程。

option Explicit    
dim wmi,proc,procs,proname,flag,WshShell    
Do  
    proname="ClientOfWatcher.exe" '需要監(jiān)測(cè)的服務(wù)進(jìn)程的名稱,自行替換這里的記事本進(jìn)程名    
set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")    
set procs=wmi.execquery("select * from win32_process")    
  flag=true    
for each proc in procs    
    if strcomp(proc.name,proname)=0 then    
      flag=false    
      exit for    
    end if    
next    
  set wmi=nothing    
  if flag then    
    Set WshShell = Wscript.CreateObject("Wscript.Shell")    
    WshShell.Run ("C:\Watcher\ClientOfWatcher.exe")    
end if    
  wscript.sleep 50000 '檢測(cè)間隔時(shí)間,這里是50秒    
loop

關(guān)于vbs系統(tǒng)運(yùn)行后,系統(tǒng)進(jìn)程中產(chǎn)生大量wscript.exe

taskkill /IM wscript.exe /F
taskkill /IM cscript.exe /F
taskkill /IM consent.exe /F
taskkill /IM ChsIME.exe /F

所有建議服務(wù)器上運(yùn)行vbs后,如果出現(xiàn)大量wscript.exe進(jìn)程,可以加上下面的命令

dim WSHshell 
set WSHshell = wscript.createobject("wscript.shell") 
WSHshell.run "taskkill /im wscript.exe /f ",0 ,true

到此這篇關(guān)于使用vbs腳本來(lái)監(jiān)控windows服務(wù)器上的應(yīng)用程序(不存在就啟動(dòng))的文章就介紹到這了,更多相關(guān)vbs守衛(wèi)進(jìn)程內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論