使用這個(gè)腳本,可以隨時(shí)讓它歇下來(lái)。當(dāng)然也可以讓它繼續(xù)工作。
前提是,你必須是本機(jī)管理員。
這個(gè)腳本使用一各很過(guò)時(shí)的終止程序方法:ntsd.exe -c q -p ProcessID。所以以前有過(guò)一個(gè)bat版,之所以用VBS是因?yàn)樾矢咭稽c(diǎn),而且沒(méi)有太多的黑色窗口。
主要思想是:循環(huán)終止程序+停止服務(wù)
代碼如下:
' 程序初始化,取得參數(shù)
If WScript.Arguments.Count = 0 Then
Call main()
WScript.Quit
Else
Dim strArg, arrTmp
For Each strArg In WScript.Arguments
arrTmp = Split(strArg, "=")
If UBound( arrTmp ) = 1 Then
Select Case LCase( arrTmp(0) )
Case "sep"
Call sep( arrTmp(1) )
Case "process_stop"
Call process_stop( arrTmp(1) )
Case "process_start"
Call process_start( arrTmp(1) )
Case "server_stop"
Call server_stop( arrTmp(1) )
Case "server_start"
Call server_start( arrTmp(1) )
Case "show_tip"
Call show_tip( arrTmp(1) )
Case Else
WScript.Quit
End Select
End If
Next
WScript.Quit
End If
' 主程序
Sub main()
If (IsRun("Rtvscan.exe", "") = 1) Or (IsRun("ccSvcHst.exe", "") = 1) Or (IsRun("SMC.exe", "") = 1) Then
Call SEP_STOP()
Else
Call SEP_START()
End If
End Sub
' 帶參數(shù)運(yùn)行
Sub sep( strMode )
Select Case LCase(strMode)
Case "stop"
Call SEP_STOP()
Case "start"
Call SEP_START()
End Select
End Sub
' 停止SEP
Sub SEP_STOP()
Set wso = CreateObject("WScript.Shell")
'kill other app
Call process_clear()
'kill sep
wso.Run """" & WScript.ScriptFullName & """ server_stop=""SENS""", 0, True
'Get Me PID
Set pid = Getobject("winmgmts://.").InstancesOf("Win32_Process")
For Each id In pid
If LCase(id.name) = LCase("Wscript.exe") Then
mepid=id.ProcessID
End If
Next
'tips
wso.Run """" & WScript.ScriptFullName & """ show_tip=stop", 0, False
'stop service
wso.Run """" & WScript.ScriptFullName & """ server_stop=""SENS""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_stop=""Symantec AntiVirus""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_stop=""ccEvtMgr""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_stop=""SmcService""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_stop=""SNAC""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_stop=""ccSetMgr""", 0, True
'kill apps
wso.Run """" & WScript.ScriptFullName & """ process_stop=ccApp.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=ccSvcHst.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=SNAC.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=Rtvscan.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=SescLU.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=Smc.exe", 0, False
wso.Run """" & WScript.ScriptFullName & """ process_stop=SmcGui.exe", 0, False
'wait
WScript.Sleep 15000
'kill other script
Set pid = Getobject("winmgmts://.").InstancesOf("Win32_Process")
For Each ps In pid
If (LCase(ps.name) = "wscript.exe") Or (LCase(ps.name) = "cscript.exe") Then ps.terminate
Next
'kill other app
Call process_clear()
'start ?
'Call SEP_START()
End Sub
' 恢復(fù)SEP
Sub SEP_START()
Set wso = CreateObject("WScript.Shell")
'tips
wso.Run """" & WScript.ScriptFullName & """ show_tip=start", 0, False
'start server
wso.Run """" & WScript.ScriptFullName & """ server_stop=""SENS""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_start=""Symantec AntiVirus""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_start=""ccEvtMgr""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_start=""SmcService""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_start=""SNAC""", 0, True
wso.Run """" & WScript.ScriptFullName & """ server_start=""ccSetMgr""", 0, True
Set wso = Nothing
End Sub
' 關(guān)閉進(jìn)程
Function process_stop( strAppName )
Dim i
For i = 1 To 100
Set pid = Getobject("winmgmts://.").InstancesOf("Win32_Process")
For Each id In pid
If LCase(id.name) = LCase(strAppName) Then
Dim wso
Set wso = CreateObject("WScript.Shell")
wso.run "ntsd.exe -c q -p " & id.ProcessID, 0, True
End If
Next
WScript.Sleep 500
Next
End Function
' 停止服務(wù)
Sub server_stop( byVal strServerName )
Set wso = CreateObject("WScript.Shell")
wso.run "sc config """ & strServerName & """ start= disabled", 0, True
wso.run "cmd /c echo Y|net stop """ & strServerName & """", 0, True
Set wso = Nothing
End Sub
' 啟動(dòng)服務(wù)
Sub server_start( byVal strServerName )
Set wso = CreateObject("WScript.Shell")
wso.run "sc config """ & strServerName & """ start= auto", 0, True
wso.run "cmd /c echo Y|net start """ & strServerName & """", 0, True
Set wso = Nothing
End Sub
' 顯示提示信息
Sub show_tip( strType )
Set wso = CreateObject("WScript.Shell")
Select Case LCase(strType)
Case "stop"
wso.popup chr(13) + "正在停止 SEP,
主站蜘蛛池模板:
广河县|
密云县|
东丰县|
龙门县|
堆龙德庆县|
平邑县|
白河县|
连云港市|
安阳市|
大兴区|
北辰区|
安达市|
观塘区|
灵丘县|
弋阳县|
垫江县|
施甸县|
互助|
佛学|
阿克陶县|
卓尼县|
三亚市|
望奎县|
洛川县|
平和县|
龙里县|
彭州市|
高邮市|
临沭县|
周宁县|
南宁市|
镇沅|
和平区|
大兴区|
香格里拉县|
民勤县|
南昌市|
益阳市|
晋中市|
昆山市|
富民县|