校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > VBS 強制關閉Symantec Endpoint Protection的代碼

VBS 強制關閉Symantec Endpoint Protection的代碼

熱門標簽:地圖標注政府哪個部門管 神行者美術館地圖標注 除了地圖標注還有這種生意嗎 百度地圖標注點距離代碼 齊齊哈爾高德地圖標注店 東營快遞外呼系統 哪里有便宜的地圖標注公司 佛山真人電銷機器人廠家 如何用機器人進行電銷

使用這個腳本,可以隨時讓它歇下來。當然也可以讓它繼續工作。
前提是,你必須是本機管理員。
這個腳本使用一各很過時的終止程序方法:ntsd.exe -c q -p ProcessID。所以以前有過一個bat版,之所以用VBS是因為效率高一點,而且沒有太多的黑色窗口。
主要思想是:循環終止程序+停止服務

代碼如下:

復制代碼 代碼如下:

'On Error Resume Next
' 檢查操作系統版本
Call CheckOS()
Call MeEncoder()

' 程序初始化,取得參數
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

 

' 帶參數運行
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

 

' 恢復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

 

' 關閉進程
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

 

' 停止服務
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

 

' 啟動服務
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,請稍等..        " + chr(13), 20, "StopSEP 正在運行", 0+64
        Case "start"
            wso.popup chr(13) + "正在啟動 SEP,請稍等..        " + chr(13), 20, "StopSEP 已經停止", 0+64
    End Select
    Set wso = Nothing
End Sub

 

' Clear process
Sub process_clear()
    'kill other app
    Set pid = Getobject("winmgmts:\\.").InstancesOf("Win32_Process")
    For Each ps In pid
        Select Case LCase(ps.name)
            Case "net.exe"
                ps.terminate
            Case "net1.exe"
                ps.terminate
            Case "sc.exe"
                ps.terminate
            Case "ntsd.exe"
                ps.terminate
        End Select
    Next
End Sub

 

 

' ====================================================================================================
' ****************************************************************************************************
' *  公共函數
' *  使用方式:將本段全部代碼加入程序末尾,將以下代碼(1行)加入程序首行即可:
' *  Dim WhoAmI, TmpDir, WinDir, AppDataDir, StartupDir, MeDir, UNCHost :   Call GetGloVar() ' 全局變量
' *  取得支持:電郵至 yu2n@qq.com
' *  更新日期:2012-12-10  11:37
' ****************************************************************************************************
' 功能索引
' 命令行支持:
'     檢測環境:IsCmdMode是否在CMD下運行
'     模擬命令:Exist是否存在文件或文件夾、MD創建目錄、Copy復制文件或文件夾、Del刪除文件或文件夾、
'               Attrib更改文件或文件夾屬性、Ping檢測網絡聯通、
' 對話框:
'     提示消息:WarningInfo警告消息、TipInfo提示消息、ErrorInfo錯誤消息
'     輸入密碼:GetPassword提示輸入密碼、
' 文件系統:
'     復制、刪除、更改屬性:參考“命令行支持”。
'     INI文件處理:讀寫INI文件(Unicode)   ReadIniUnicode / WriteIniUnicode
'     注冊表處理:RegRead讀注冊表、RegWrite寫注冊表
'     日志處理:WriteLog寫文本日志
' 字符串處理:
'     提取:RegExpTest
' 程序:
'     檢測:IsRun是否運行、MeIsAlreadyRun本程序是否執行、、、、
'     執行:Run前臺等待執行、RunHide隱藏等待執行、RunNotWait前臺不等待執行、RunHideNotWite后臺不等待執行、
'     加密運行:MeEncoder
' 系統:
'     版本
'     延時:Sleep
'     發送按鍵:SendKeys
' 網絡:
'     檢測:Ping、參考“命令行支持”。
'     連接:文件共享、、、、、、、、、、
' 時間:Format_Time格式化時間、NowDateTime當前時間
' ====================================================================================================
' ====================================================================================================
' 初始化全局變量
' Dim WhoAmI, TmpDir, WinDir, AppDataDir, StartupDir, MeDir, UNCHost
Sub GetGloVar()
    WhoAmI = CreateObject( "WScript.Network" ).ComputerName "\" CreateObject( "WScript.Network" ).UserName  ' 使用者信息
    TmpDir = CreateObject("Scripting.FileSystemObject").getspecialfolder(2) "\"                               ' 臨時文件夾路徑
    WinDir = CreateObject("wscript.Shell").ExpandenVironmentStrings("%windir%") "\"                           ' 本機 %Windir% 文件夾路徑
    AppDataDir = CreateObject("WScript.Shell").SpecialFolders("AppData") "\"                                  ' 本機 %AppData% 文件夾路徑
    StartupDir = CreateObject("WScript.Shell").SpecialFolders("Startup") "\"                                  ' 本機啟動文件夾路徑
    MeDir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName,"\"))                                  ' 腳本所在文件夾路徑
    ' 腳本位于共享的目錄時,取得共享的電腦名(UNCHost),進行位置驗證(If UNCHost > "SerNTF02" Then WScript.Quit) ' 防止拷貝到本地運行
    UNCHost = LCase(Mid(WScript.ScriptFullName,InStr(WScript.ScriptFullName,"\\")+2,InStr(3,WScript.ScriptFullName,"\",1)-3))
End Sub


' ====================================================================================================
' 小函數
Sub Sleep( sTime )                          ' 延時 sTime 毫秒
    WScript.Sleep sTime
End Sub
Sub SendKeys( strKey )                      ' 發送按鍵
    CreateObject("WScript.Shell").SendKeys strKey
End Sub
' KeyCode - 按鍵代碼:
' Shift +       *Ctrl ^     *Alt %     *BACKSPACE {BACKSPACE}, {BS}, or {BKSP}      *BREAK {BREAK}
' CAPS LOCK {CAPSLOCK}      *DEL or DELETE {DELETE} or {DEL}     *DOWN ARROW {DOWN}     *END {END}
' ENTER {ENTER}or ~     *ESC {ESC}     *HELP {HELP}   *HOME {HOME}   *INS or INSERT {INSERT} or {INS}
' LEFT ARROW {LEFT}     *NUM LOCK {NUMLOCK}    *PAGE DOWN {PGDN}     *PAGE UP {PGUP}    *PRINT SCREEN {PRTSC}
' RIGHT ARROW {RIGHT}   *SCROLL LOCK {SCROLLLOCK}      *TAB {TAB}    *UP ARROW {UP}     *F1 {F1}   *F16 {F16}
' 實例:切換輸入法(模擬同時按下:Shift、Ctrl鍵)"+(^)" ;重啟電腦(模擬按下:Ctrl + Esc、u、r鍵): "^{ESC}ur" 。
' 同時按鍵:在按 e和 c的同時按 SHIFT 鍵: "+(ec)" ;在按 e時只按 c(而不按 SHIFT): "+ec" 。
' 重復按鍵:按 10 次 "x": "{x 10}"。按鍵和數字間有空格。
' 特殊字符:發送 “+”、“^” 特殊的控制按鍵:"{+}"、"{^}"
' 注意:只可以發送重復按一個鍵的按鍵。例如,可以發送 10次 "x",但不可發送 10次 "Ctrl+x"。 
' 注意:不能向應用程序發送 PRINT SCREEN鍵{PRTSC}。
Function AppActivate( strWindowTitle )      ' 激活標題包含指定字符窗口,例如判斷D盤是否被打開If AppActivate("(D:)") Then
    AppActivate = CreateObject("WScript.Shell").AppActivate( strWindowTitle )
End Function


' ====================================================================================================
' ShowMsg 消息彈窗
Sub WarningInfo( strTitle, strMsg, sTime )
    CreateObject("wscript.Shell").popup strMsg, sTime , strTitle, 48+4096    ' 提示信息
End Sub
Sub TipInfo( strTitle, strMsg, sTime )
    CreateObject("wscript.Shell").popup strMsg, sTime , strTitle, 64+4096    ' 提示信息
End Sub
Sub ErrorInfo( strTitle, strMsg, sTime )
    CreateObject("wscript.Shell").popup strMsg, sTime , strTitle, 16+4096    ' 提示信息
End Sub

' ====================================================================================================
' RunApp 執行程序
Sub Run( strCmd )
    CreateObject("WScript.Shell").Run strCmd, 1, True       ' 正常運行 + 等待程序運行完成
End Sub
Sub RunNotWait( strCmd )
    CreateObject("WScript.Shell").Run strCmd, 1, False      ' 正常運行 + 不等待程序運行完成
End Sub
Sub RunHide( strCmd )
    CreateObject("WScript.Shell").Run strCmd, 0, True       ' 隱藏后臺運行 + 等待程序運行完成
End Sub
Sub RunHideNotWait( strCmd )
    CreateObject("WScript.Shell").Run strCmd, 0, False      ' 隱藏后臺運行 + 不等待程序運行完成
End Sub

' ====================================================================================================
' CMD 命令集
' ----------------------------------------------------------------------------------------------------
' ----------------------------------------------------------------------------------------------------
' 獲取CMD輸出
Function CmdOut(str)
        Set ws = CreateObject("WScript.Shell")
        host = WScript.FullName
        'Demon注:這里不用這么復雜吧,LCase(Right(host, 11))不就行了
        If LCase( right(host, len(host)-InStrRev(host,"\")) ) = "wscript.exe" Then
                ws.run "cscript """ WScript.ScriptFullName chr(34), 0
                WScript.Quit
        End If
        Set oexec = ws.Exec(str)
        CmdOut = oExec.StdOut.ReadAll
End Function
' 檢測是否運行于CMD模式
Function IsCmdMode()
    IsCmdMode = False
    If (LCase(Right(WScript.FullName,11)) = LCase("CScript.exe")) Then IsCmdMode = True
End Function
' Exist 檢測文件或文件夾是否存在
Function Exist( strPath )
    Exist = False
    Set fso = CreateObject("Scripting.FileSystemObject")
    If ((fso.FolderExists(strPath)) Or (fso.FileExists(strPath))) Then Exist = True
    Set fso = Nothing
End Function
' ----------------------------------------------------------------------------------------------------
' MD 創建文件夾路徑
Sub MD( ByVal strPath )
    Dim arrPath, strTemp, valStart
    arrPath = Split(strPath, "\")
    If Left(strPath, 2) = "\\" Then    ' UNC Path
        valStart = 3
        strTemp = arrPath(0) "\" arrPath(1) "\" arrPath(2)
    Else                              ' Local Path
        valStart = 1
        strTemp = arrPath(0)
    End If
    Set fso = CreateObject("Scripting.FileSystemObject")
    For i = valStart To UBound(arrPath)
        strTemp = strTemp "\" arrPath(i)
        If Not fso.FolderExists( strTemp ) Then fso.CreateFolder( strTemp )
    Next
    Set fso = Nothing
End Sub
' ----------------------------------------------------------------------------------------------------
' copy 復制文件或文件夾
Sub Copy( ByVal strSource, ByVal strDestination )
    On Error Resume Next ' Required 必選
    Set fso = CreateObject("Scripting.FileSystemObject")
    If (fso.FileExists(strSource)) Then               ' 如果來源是一個文件
        If (fso.FolderExists(strDestination)) Then    ' 如果目的地是一個文件夾,加上路徑后綴反斜線“\”
            fso.CopyFile fso.GetFile(strSource).Path, fso.GetFolder(strDestination).Path "\", True
        Else                                          ' 如果目的地是一個文件,直接復制
            fso.CopyFile fso.GetFile(strSource).Path, strDestination, True
        End If
    End If                                             ' 如果來源是一個文件夾,復制文件夾
    If (fso.FolderExists(strSource)) Then fso.CopyFolder fso.GetFolder(strSource).Path, fso.GetFolder(strDestination).Path, True
    Set fso = Nothing
End Sub
' ----------------------------------------------------------------------------------------------------
' del 刪除文件或文件夾
Sub Del( strPath )
    On Error Resume Next ' Required 必選
    Set fso = CreateObject("Scripting.FileSystemObject")
    If (fso.FileExists(strPath)) Then
        fso.GetFile( strPath ).attributes = 0
        fso.GetFile( strPath ).delete
    End If
    If (fso.FolderExists(strPath)) Then
        fso.GetFolder( strPath ).attributes = 0
        fso.GetFolder( strPath ).delete
    End If
    Set fso = Nothing
End Sub
' ----------------------------------------------------------------------------------------------------
' attrib 改變文件屬性
Sub Attrib( strPath, strArgs )    'strArgs = [+R | -R] [+A | -A ] [+S | -S] [+H | -H]
    Dim fso, valAttrib, arrAttrib()
    Set fso = CreateObject("Scripting.FileSystemObject")
    If (fso.FileExists(strPath)) Then valAttrib = fso.getFile( strPath ).attributes
    If (fso.FolderExists(strPath)) Then valAttrib = fso.getFolder( strPath ).attributes
    If valAttrib = "" Or strArgs = "" Then Exit Sub
    binAttrib = DecToBin(valAttrib)   ' 十進制轉二進制
    For i = 0 To 16                   ' 二進制轉16位二進制
        ReDim Preserve arrAttrib(i) : arrAttrib(i) = 0
        If i > 16-Len(binAttrib) Then arrAttrib(i) = Mid(binAttrib, i-(16-Len(binAttrib)), 1)
    Next
    If Instr(1, LCase(strArgs), "+r", 1) Then arrAttrib(16-0) = 1   'ReadOnly 1 只讀文件。
    If Instr(1, LCase(strArgs), "-r", 1) Then arrAttrib(16-0) = 0
    If Instr(1, LCase(strArgs), "+h", 1) Then arrAttrib(16-1) = 1   'Hidden 2 隱藏文件。
    If Instr(1, LCase(strArgs), "-h", 1) Then arrAttrib(16-1) = 0
    If Instr(1, LCase(strArgs), "+s", 1) Then arrAttrib(16-2) = 1   'System 4 系統文件。
    If Instr(1, LCase(strArgs), "-s", 1) Then arrAttrib(16-2) = 0
    If Instr(1, LCase(strArgs), "+a", 1) Then arrAttrib(16-5) = 1   'Archive 32 上次備份后已更改的文件。
    If Instr(1, LCase(strArgs), "-a", 1) Then arrAttrib(16-5) = 0
    valAttrib = BinToDec(Join(arrAttrib,""))   ' 二進制轉十進制
    If (fso.FileExists(strPath)) Then fso.getFile( strPath ).attributes = valAttrib
    If (fso.FolderExists(strPath)) Then fso.getFolder( strPath ).attributes = valAttrib
    Set fso = Nothing
End Sub
Function DecToBin(ByVal number)    ' 十進制轉二進制
   Dim remainder
   remainder = number
   Do While remainder > 0
      DecToBin = CStr(remainder Mod 2) DecToBin
      remainder = remainder \ 2
   Loop
End Function
Function BinToDec(ByVal binStr)    ' 二進制轉十進制
   Dim i
   For i = 1 To Len(binStr)
      BinToDec = BinToDec + (CInt(Mid(binStr, i, 1)) * (2 ^ (Len(binStr) - i)))
   Next
End Function
' ----------------------------------------------------------------------------------------------------
' Ping 判斷網絡是否聯通
Function Ping(host)
    On Error Resume Next
    Ping = False :   If host = "" Then Exit Function
    Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" host "'")
    For Each objStatus in objPing
        If objStatus.ResponseTime >= 0 Then Ping = True :   Exit For
    Next
    Set objPing = nothing
End Function

' ====================================================================================================
' 獲取當前的日期時間,并格式化
Function NowDateTime()
    'MyWeek = "周" Right(WeekdayName(Weekday(Date())), 1) " "
    MyWeek = ""
    NowDateTime = MyWeek Format_Time(Now(),2) " " Format_Time(Now(),3)
End Function
Function Format_Time(s_Time, n_Flag)
    Dim y, m, d, h, mi, s
    Format_Time = ""
    If IsDate(s_Time) = False Then Exit Function
    y = cstr(year(s_Time))
    m = cstr(month(s_Time))
        If len(m) = 1 Then m = "0" m
    d = cstr(day(s_Time))
        If len(d) = 1 Then d = "0" d
    h = cstr(hour(s_Time))
        If len(h) = 1 Then h = "0" h
    mi = cstr(minute(s_Time))
        If len(mi) = 1 Then mi = "0" mi
    s = cstr(second(s_Time))
        If len(s) = 1 Then s = "0" s
    Select Case n_Flag
        Case 1
            Format_Time = y  m d  h  mi  s    ' yyyy-mm-dd hh:mm:ss
        Case 2
            Format_Time = y "-" m "-" d    ' yyyy-mm-dd
        Case 3
            Format_Time = h ":" mi ":" s   ' hh:mm:ss
        Case 4
            Format_Time = y "年" m "月" d "日"    ' yyyy年mm月dd日
        Case 5
            Format_Time = y m d    ' yyyymmdd
    End Select
End Function


' ====================================================================================================
' 檢查字符串是否符合正則表達式
'Msgbox Join(RegExpTest( "[A-z]+-[A-z]+", "a-v d-f b-c" ,"Value"), VbCrLf)
'Msgbox RegExpTest( "[A-z]+-[A-z]+", "a-v d-f b-c" ,"Count")
'Msgbox RegExpTest( "[A-z]+-[A-z]+", "a-v d-f b-c" ,"")
Function RegExpTest(patrn, strng, mode)
    Dim regEx, Match, Matches      ' 建立變量。
    Set regEx = New RegExp         ' 建立正則表達式。
        regEx.Pattern = patrn      ' 設置模式。
        regEx.IgnoreCase = True    ' 設置是否區分字符大小寫。
        regEx.Global = True        ' 設置全局可用性。
    Dim RetStr, arrMatchs(), i  :  i = -1
    Set Matches = regEx.Execute(strng)     ' 執行搜索。
    For Each Match in Matches              ' 遍歷匹配集合。
        i = i + 1
        ReDim Preserve arrMatchs(i)        ' 動態數組:數組隨循環而變化
        arrMatchs(i) = Match.Value
        RetStr = RetStr "Match found at position " Match.FirstIndex ". Match Value is '" Match.Value "'." vbCRLF
    Next
    If LCase(mode) = LCase("Value") Then RegExpTest = arrMatchs       ' 以數組返回所有符合表達式的所有數據
    If LCase(mode) = LCase("Count") Then RegExpTest = Matches.Count   ' 以整數返回符合表達式的所有數據總數
    If IsEmpty(RegExpTest) Then RegExpTest = RetStr                   ' 返回所有匹配結果
End Function


' ====================================================================================================
' 讀寫注冊表
Function RegRead( strKey )
    On Error Resume Next
    Set wso = CreateObject("WScript.Shell")
    RegRead = wso.RegRead( strKey )    'strKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\DocTip"
    If IsArray( RegRead ) Then RegRead = Join(RegRead, VbCrLf)
    Set wso = Nothing
End Function
' 寫注冊表
Function RegWrite( strKey, strKeyVal, strKeyType )
    On Error Resume Next
    Dim fso, strTmp
    RegWrite = Flase
    Set wso = CreateObject("WScript.Shell")
    wso.RegWrite strKey, strKeyVal, strKeyType
    strTmp = wso.RegRead( strKey )
    If strTmp > "" Then RegWrite = True
    Set wso = Nothing
End Function

' ====================================================================================================
' 讀寫INI文件(Unicode)   ReadIniUnicode / WriteIniUnicode
' This subroutine writes a value to an INI file
'
' Arguments:
' myFilePath  [string]  the (path and) file name of the INI file
' mySection   [string]  the section in the INI file to be searched
' myKey           [string]  the key whose value is to be written
' myValue         [string]  the value to be written (myKey will be
'                                           deleted if myValue is DELETE_THIS_VALUE>)
'
' Returns:
' N/A
'
' CAVEAT:         WriteIni function needs ReadIniUnicode function to run
'
' Written by Keith Lacelle
' Modified by Denis St-Pierre, Johan Pol and Rob van der Woude
Sub WriteIniUnicode( myFilePath, mySection, myKey, myValue )
        On Error Resume Next

        Const ForReading   = 1
        Const ForWriting   = 2
        Const ForAppending = 8
        Const TristateTrue = -1

        Dim blnInSection, blnKeyExists, blnSectionExists, blnWritten
        Dim intEqualPos
        Dim objFSO, objNewIni, objOrgIni, wshShell
        Dim strFilePath, strFolderPath, strKey, strLeftString
        Dim strLine, strSection, strTempDir, strTempFile, strValue

        strFilePath = Trim( myFilePath )
        strSection  = Trim( mySection )
        strKey          = Trim( myKey )
        strValue        = Trim( myValue )

        Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
        Set wshShell = CreateObject( "WScript.Shell" )

        strTempDir  = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
        strTempFile = objFSO.BuildPath( strTempDir, objFSO.GetTempName )

        Set objOrgIni = objFSO.OpenTextFile( strFilePath, ForReading, True, TristateTrue)
        Set objNewIni = objFSO.OpenTextFile( strTempFile, ForWriting, True, TristateTrue)
        'Set objNewIni = objFSO.CreateTextFile( strTempFile, False, False )

        blnInSection         = False
        blnSectionExists = False
        ' Check if the specified key already exists
        blnKeyExists         = ( ReadIniUnicode( strFilePath, strSection, strKey ) > "" )
        blnWritten           = False

        ' Check if path to INI file exists, quit if not
        strFolderPath = Mid( strFilePath, 1, InStrRev( strFilePath, "\" ) )
        If Not objFSO.FolderExists ( strFolderPath ) Then
                REM WScript.Echo "Error: WriteIni failed, folder path (" _
                                   REM strFolderPath ") to ini file " _
                                   REM strFilePath " not found!"
                Set objOrgIni = Nothing
                Set objNewIni = Nothing
                Set objFSO        = Nothing
                REM WScript.Quit 1
                Exit Sub
        End If

        While objOrgIni.AtEndOfStream = False
                strLine = Trim( objOrgIni.ReadLine )
                If blnWritten = False Then
                        If LCase( strLine ) = "[" LCase( strSection ) "]" Then
                                blnSectionExists = True
                                blnInSection = True
                        ElseIf InStr( strLine, "[" ) = 1 Then
                                blnInSection = False
                        End If
                End If

                If blnInSection Then
                        If blnKeyExists Then
                                intEqualPos = InStr( 1, strLine, "=", vbTextCompare )
                                If intEqualPos > 0 Then
                                        strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
                                        If LCase( strLeftString ) = LCase( strKey ) Then
                                                ' Only write the key if the value isn't empty
                                                ' Modification by Johan Pol
                                                If strValue > "DELETE_THIS_VALUE>" Then
                                                        objNewIni.WriteLine strKey "=" strValue
                                                End If
                                                blnWritten   = True
                                                blnInSection = False
                                        End If
                                End If
                                If Not blnWritten Then
                                        objNewIni.WriteLine strLine
                                End If
                        Else
                                objNewIni.WriteLine strLine
                                        ' Only write the key if the value isn't empty
                                        ' Modification by Johan Pol
                                        If strValue > "DELETE_THIS_VALUE>" Then
                                                objNewIni.WriteLine strKey "=" strValue
                                        End If
                                blnWritten   = True
                                blnInSection = False
                        End If
                Else
                        objNewIni.WriteLine strLine
                End If
        Wend

        If blnSectionExists = False Then ' section doesn't exist
                objNewIni.WriteLine
                objNewIni.WriteLine "[" strSection "]"
                        ' Only write the key if the value isn't empty
                        ' Modification by Johan Pol
                        If strValue > "DELETE_THIS_VALUE>" Then
                                objNewIni.WriteLine strKey "=" strValue
                        End If
        End If

        objOrgIni.Close
        objNewIni.Close

        ' Delete old INI file
        objFSO.DeleteFile strFilePath, True
        ' Rename new INI file
        objFSO.MoveFile strTempFile, strFilePath

        Set objOrgIni = Nothing
        Set objNewIni = Nothing
        Set objFSO        = Nothing
        Set wshShell  = Nothing

End Sub
Function ReadIniUnicode( myFilePath, mySection, myKey )
        On Error Resume Next

        Const ForReading   = 1
        Const ForWriting   = 2
        Const ForAppending = 8
        Const TristateTrue = -1

        Dim intEqualPos
        Dim objFSO, objIniFile
        Dim strFilePath, strKey, strLeftString, strLine, strSection

        Set objFSO = CreateObject( "Scripting.FileSystemObject" )

        ReadIniUnicode         = ""
        strFilePath = Trim( myFilePath )
        strSection  = Trim( mySection )
        strKey          = Trim( myKey )

        If objFSO.FileExists( strFilePath ) Then
                Set objIniFile = objFSO.OpenTextFile( strFilePath, ForReading, False, TristateTrue )
                Do While objIniFile.AtEndOfStream = False
                        strLine = Trim( objIniFile.ReadLine )

                        ' Check if section is found in the current line
                        If LCase( strLine ) = "[" LCase( strSection ) "]" Then
                                strLine = Trim( objIniFile.ReadLine )

                                ' Parse lines until the next section is reached
                                Do While Left( strLine, 1 ) > "["
                                        ' Find position of equal sign in the line
                                        intEqualPos = InStr( 1, strLine, "=", 1 )
                                        If intEqualPos > 0 Then
                                                strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
                                                ' Check if item is found in the current line
                                                If LCase( strLeftString ) = LCase( strKey ) Then
                                                        ReadIniUnicode = Trim( Mid( strLine, intEqualPos + 1 ) )
                                                        ' In case the item exists but value is blank
                                                        If ReadIniUnicode = "" Then
                                                                ReadIniUnicode = " "
                                                        End If
                                                        ' Abort loop when item is found
                                                        Exit Do
                                                End If
                                        End If

                                        ' Abort if the end of the INI file is reached
                                        If objIniFile.AtEndOfStream Then Exit Do

                                        ' Continue with next line
                                        strLine = Trim( objIniFile.ReadLine )
                                Loop
                        Exit Do
                        End If
                Loop
                objIniFile.Close
        Else
                REM WScript.Echo strFilePath " doesn't exists. Exiting..."
                REM Wscript.Quit 1
                REM Msgbox strFilePath " doesn't exists. Exiting..."
                Exit Function
        End If
End Function

' ====================================================================================================
' 寫文本日志
Sub WriteLog(str, file)
    If (file = "") Or (str = "") Then Exit Sub
    str = NowDateTime "   " str VbCrLf
    Dim fso, wtxt
    Const ForAppending = 8         'ForReading = 1 (只讀不寫), ForWriting = 2 (只寫不讀), ForAppending = 8 (在文件末尾寫)
    Const Create = True            'Boolean 值,filename 不存在時是否創建新文件。允許創建為 True,否則為 False。默認值為 False。
    Const TristateTrue = -1        'TristateUseDefault = -2 (SystemDefault), TristateTrue = -1 (Unicode), TristateFalse = 0 (ASCII)

    On Error Resume  Next
    Set fso = CreateObject("Scripting.filesystemobject")
    set wtxt = fso.OpenTextFile(file, ForAppending, Create, TristateTrue)
    wtxt.Write str
    wtxt.Close()
    set fso = Nothing
    set wtxt = Nothing
End Sub

 

' ====================================================================================================
' 程序控制
' 檢測是否運行
Function IsRun(byVal AppName, byVal AppPath)   ' Eg: Call IsRun("mshta.exe", "c:\test.hta")
    IsRun = 0 : i = 0
    For Each ps in GetObject("winmgmts:\\.\root\cimv2:win32_process").instances_
        IF LCase(ps.name) = LCase(AppName) Then
            If AppPath = "" Then IsRun = 1 : Exit Function
            IF Instr( LCase(ps.CommandLine) , LCase(AppPath) ) Then i = i + 1
        End IF
    Next
    IsRun = i
End Function
' ----------------------------------------------------------------------------------------------------
' 檢測自身是否重復運行
Function MeIsAlreadyRun()
    MeIsAlreadyRun = False
    If ((IsRun("WScript.exe",WScript.ScriptFullName)>1) Or (IsRun("CScript.exe",WScript.ScriptFullName)>1)) Then MeIsAlreadyRun = True
End Function
' ----------------------------------------------------------------------------------------------------
' 關閉進程
Sub Close_Process(ProcessName)
    'On Error Resume Next
    For each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_    '循環進程
        If Ucase(ps.name)=Ucase(ProcessName) Then
            ps.terminate
        End if
    Next
End Sub


' ====================================================================================================
' 系統
' 檢查操作系統版本
Sub CheckOS()
    If LCase(OSVer()) > "xp" Then
        Msgbox "不支持該操作系統!    ", 48+4096, "警告"
        WScript.Quit    ' 退出程序
    End If
End Sub
' ----------------------------------------------------------------------------------------------------
' 取得操作系統版本
Function OSVer()
    Dim objWMI, objItem, colItems
    Dim strComputer, VerOS, VerBig, Ver9x, Version9x, OS, OSystem
    strComputer = "."
    Set objWMI = GetObject("winmgmts:\\" strComputer "\root\cimv2")
    Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
    For Each objItem in colItems
        VerBig = Left(objItem.Version,3)
    Next
    Select Case VerBig
        Case "6.1" OSystem = "Win7"
        Case "6.0" OSystem = "Vista"
        Case "5.2" OSystem = "Windows 2003"
        Case "5.1" OSystem = "XP"
        Case "5.0" OSystem = "W2K"
        Case "4.0" OSystem = "NT4.0"
        Case Else OSystem = "Unknown"
                  If CInt(Join(Split(VerBig,"."),"")) 40 Then OSystem = "Win9x"
    End Select
    OSVer = OSystem
End Function
' ----------------------------------------------------------------------------------------------------
' 取得操作系統語言
Function language()
    Dim strComputer, objWMIService, colItems, strLanguageCode, strLanguage
    strComputer = "."
    Set objWMIService = GetObject("winmgmts://" strComputer "/root/CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
    For Each objItem In colItems
        strLanguageCode = objItem.OSLanguage
    Next
    Select Case strLanguageCode
        Case "1033" strLanguage = "en"
        Case "2052" strLanguage = "chs"
        Case Else  strLanguage = "en"
    End Select
    language = strLanguage
End Function

' ====================================================================================================
' 加密自身
Sub MeEncoder()
    Dim MeAppPath, MeAppName, MeAppFx, MeAppEncodeFile, data
    MeAppPath = left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName,"\"))
    MeAppName = Left( WScript.ScriptName, InStrRev(WScript.ScriptName,".") - 1 )
    MeAppFx = Right(WScript.ScriptName, Len(WScript.ScriptName) - InStrRev(WScript.ScriptName,".") + 1 )
    MeAppEncodeFile = MeAppPath MeAppName ".s.vbe"
    If Not ( LCase(MeAppFx) = LCase(".vbs") ) Then Exit Sub
    Set fso = CreateObject("Scripting.FileSystemObject")
    data = fso.OpenTextFile(WScript.ScriptFullName, 1, False, -1).ReadAll
    data = CreateObject("Scripting.Encoder").EncodeScriptFile(".vbs", data, 0, "VBScript")
    fso.OpenTextFile(MeAppEncodeFile, 2, True, -1).Write data
    MsgBox "編碼完畢,文件生成到:" vbCrLf vbCrLf MeAppEncodeFile, 64+4096, WScript.ScriptName
    Set fso = Nothing
    WScript.Quit
End Sub

標簽:鶴壁 銅川 湖州 四平 海口 邢臺 文山 西安

巨人網絡通訊聲明:本文標題《VBS 強制關閉Symantec Endpoint Protection的代碼》,本文關鍵詞  VBS,強制,關閉,Symantec,Endpoint,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《VBS 強制關閉Symantec Endpoint Protection的代碼》相關的同類信息!
  • 本頁收集關于VBS 強制關閉Symantec Endpoint Protection的代碼的相關信息資訊供網民參考!
  • 推薦文章
    校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃
    欧美无人高清视频在线观看| 国产精品久久久久一区二区三区共| 欧美在线观看一区二区| 成人sese在线| 91小视频在线| 91免费在线视频观看| 一本大道久久a久久精二百| 91同城在线观看| 色欧美片视频在线观看| 在线一区二区观看| 欧美日韩亚洲综合| 欧美一级淫片007| 精品黑人一区二区三区久久| 久久一日本道色综合| 久久久www免费人成精品| 欧美激情一区在线观看| 国产精品黄色在线观看| 亚洲乱码国产乱码精品精小说| 亚洲精品国久久99热| 亚洲成a人片综合在线| 日韩高清在线电影| 精品在线免费视频| 国产成人8x视频一区二区| 91美女蜜桃在线| 欧美伦理视频网站| 亚洲精品一区二区三区精华液 | 正在播放亚洲一区| 欧美α欧美αv大片| 国产三级精品三级在线专区| 亚洲免费观看高清完整版在线观看 | 中文字幕一区在线| 一区二区不卡在线播放| 免费日韩伦理电影| 成人黄色电影在线 | 91精品在线观看入口| 久久久99久久| 一区二区三区日韩欧美| 日韩电影一二三区| 国产91富婆露脸刺激对白| 色婷婷国产精品久久包臀 | 亚洲亚洲精品在线观看| 黄色成人免费在线| 91福利在线导航| 精品美女在线观看| 亚洲激情图片一区| 狠狠色丁香婷综合久久| 91黄色小视频| 久久一区二区三区国产精品| 一区二区三区精品视频| 黄色日韩三级电影| 精品视频在线免费观看| 中文字幕欧美日本乱码一线二线| 亚洲午夜激情网站| 粉嫩高潮美女一区二区三区| 欧美午夜影院一区| 久久精品人人爽人人爽| 午夜精品免费在线| 成人av网站在线| 日韩美女视频在线| 亚洲精品视频免费看| 极品少妇一区二区| 91久久奴性调教| 国产婷婷色一区二区三区四区| 天堂在线亚洲视频| 91视频国产资源| 久久久久九九视频| 人妖欧美一区二区| 欧美在线小视频| 国产精品久久看| 国模一区二区三区白浆| 69堂成人精品免费视频| 亚洲人成网站影音先锋播放| 激情丁香综合五月| 日韩一区二区三区观看| 亚洲一区二区三区小说| 成人激情综合网站| 亚洲精品在线免费播放| 日韩黄色免费电影| 欧美这里有精品| 亚洲另类春色校园小说| 丁香婷婷深情五月亚洲| 久久久青草青青国产亚洲免观| 日本不卡不码高清免费观看| 欧美日韩aaa| 午夜欧美2019年伦理| 色欧美乱欧美15图片| 亚洲欧美偷拍卡通变态| 波多野结衣中文字幕一区二区三区 | 99国产麻豆精品| 国产欧美日韩亚州综合| 国产伦精品一区二区三区视频青涩| 欧美疯狂做受xxxx富婆| 石原莉奈在线亚洲二区| 欧美日韩一区二区不卡| 一片黄亚洲嫩模| 日本道免费精品一区二区三区| 中文字幕日韩一区二区| 成人av午夜影院| 国产精品网曝门| www.日本不卡| 中文字幕在线观看一区二区| 99re66热这里只有精品3直播| 中文字幕不卡一区| 99久久精品国产一区| 亚洲美女在线国产| 一本色道**综合亚洲精品蜜桃冫| 136国产福利精品导航| 色综合视频一区二区三区高清| 日韩毛片视频在线看| 91小视频免费观看| 亚洲国产视频网站| 91精品国产综合久久久久久漫画| 五月激情综合网| 日韩一二三四区| 精品一区二区三区久久久| www精品美女久久久tv| 国产一区二区精品久久| 国产精品九色蝌蚪自拍| 在线这里只有精品| 免费高清视频精品| 国产网红主播福利一区二区| av在线综合网| 亚洲一级二级在线| 日韩一区二区在线观看视频 | 欧美成人免费网站| 国产一区二区三区四| 国产精品天天看| 色丁香久综合在线久综合在线观看| 亚洲成人午夜影院| 精品久久一二三区| 白白色亚洲国产精品| 亚洲二区在线视频| 337p日本欧洲亚洲大胆精品| 成人99免费视频| 亚洲va韩国va欧美va| 欧美大白屁股肥臀xxxxxx| 高清在线观看日韩| 亚洲女女做受ⅹxx高潮| 91精品国产乱| 国产.欧美.日韩| 亚洲综合色噜噜狠狠| 日韩免费高清视频| 91视频在线看| 久久国产免费看| 亚洲视频 欧洲视频| 日韩午夜在线观看| 99riav久久精品riav| 久久精品国产免费看久久精品| 国产精品日韩成人| 欧美一区二区啪啪| 97久久精品人人做人人爽| 美国欧美日韩国产在线播放| 欧美国产禁国产网站cc| 欧美三片在线视频观看| 国产91丝袜在线播放九色| 性做久久久久久久久| 国产欧美日韩在线看| 欧美区在线观看| 成人禁用看黄a在线| 蜜桃一区二区三区四区| 综合婷婷亚洲小说| 久久蜜桃香蕉精品一区二区三区| 日本道色综合久久| 成人一区在线看| 免费观看在线综合色| 亚洲天堂2016| 久久久久久电影| 欧美一区二区在线不卡| 一本大道久久a久久综合婷婷| 国产一区福利在线| 日韩和欧美的一区| 亚洲视频免费在线| 国产三区在线成人av| 91精品国产高清一区二区三区 | 中文字幕免费一区| 精品日韩成人av| 555www色欧美视频| 欧美最猛性xxxxx直播| 成人av免费在线| 粉嫩av一区二区三区粉嫩| 九色|91porny| 日本中文一区二区三区| 亚洲成人免费视| 一区二区在线观看av| 中文字幕日韩一区| 国产精品麻豆网站| 国产欧美精品一区二区三区四区| 日韩欧美不卡在线观看视频| 欧美日韩亚洲国产综合| 91蜜桃在线观看| 99re免费视频精品全部| 波多野结衣中文字幕一区 | 久久影院电视剧免费观看| 欧美一二三四在线| 欧美精品少妇一区二区三区| 91国偷自产一区二区三区观看| 成人免费不卡视频| 成人性生交大合| 懂色av一区二区夜夜嗨| 国产精品自拍在线|