我有一个脚本可以在PC登录时创建用户协议。此脚本强制用户单击“我拒绝”#34;它将自动关闭用户,或者我接受"这将关闭协议并让用户继续照常进行。
该程序运行正常,唯一的问题是用户可以使用任务管理器来关闭协议。所有用户都具有大多数正常访问权限,但每个人都可以访问任务管理器来关闭程序。
我想知道是否有什么东西我可以添加到脚本或某种方式暂时禁用CTRL + ALT + DEL /任务管理器,以便协议程序无法关闭而不点击"我接受"或者"我拒绝"。
脚本如下所示:
AUP.hta
<html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="LOGIN"
VERSION="1.0.0.0"
BORDER="none"
INNERBORDER="no"
CAPTION="no"
SYSMENU="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
ICON="NO"
SCROLL="no"
SCROLLFLAT="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
SHOWINTASKBAR="no"
CONTEXTMENU="no"
SELECTION="no"/>
<script language="VBScript">
Sub logon
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "C:\Users\chandlerb\Desktop\AUP_Files\AUP\AUP.vbs"
window.close
End Sub
Sub logoff
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "shutdown /l"
End Sub
</script>
<script language="JavaScript">
function document.onkeydown() {
var alt=window.event.altKey;
if (event.keyCode==116 || event.keyCode==27 || alt && event.keyCode==115) {
event.keyCode=0;
event.cancelBubble=true;
return false;
}
}
</script>
<style type="text/css">
body {
margin:40px;
font:11px Verdana, Geneva, sans-serif;
}
hr {
margin-bottom:15px;
height:1px;
}
.statement_title {
margin-bottom:15px;
font-size:18px;
}
.statement {
margin-bottom:20px;
}
.button {
float: right;
margin-left:10px;
background-color:#3d94f6;
border:1px solid #337fed;
display:inline-block;
color:#ffffff;
font-family:arial;
font-size:15px;
font-weight:bold;
padding:9px 25px;
text-decoration:none;
cursor:pointer;
}
</style>
</head>
<body>
<div class="statement_title">End User Licence Agreement</div>
<hr>
<div class="statement">
By clicking "I Accept" below you agree to adhere to our End User Licence Agreement. Any breaking of the Terms Of Service held withing the EULA
are grounds for user account termination and will result in a disciplinary. The EULA <strong>must</strong> be accepted to use any network
facilities and services.
</div>
<div class="statement">
By clicking "I Decline" you are declining our EULA and will be unable to use the network and you will be logged off the current computer.
</div>
<hr>
<div>
<a href onClick="logoff" class="button">I Decline</a>
</div>
<div>
<a href onClick="logon" class="button">I Accept</a>
</div>
</body>
</html>
Logon.VBS
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
UserName = objShell.ExpandEnvironmentStrings("%USERNAME%")
If (fso.FileExists("C:\Users\chandlerb\Desktop\AUP_Files\AUP\" & UserName & ".txt")) Then
WScript.Quit()
Else
dim strComputer
dim wmiNS
dim wmiQuery
dim objWMIService
dim colItems
dim objItem
Dim strOUT
strComputer = "."
wmiNS = "\root\cimv2"
wmiQuery = "Select processID from win32_process where name = 'explorer.exe'"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)
For Each objItem in colItems
objItem.terminate(1)
subLaunch
Next
Sub subLaunch
Dim objShell
Dim strProg
strProg = "C:\Users\chandlerb\Desktop\AUP_Files\AUP\AUP.hta"
Const MaxWindow = 3
Const blnWait = True
Set objShell = CreateObject("wscript.shell")
objShell.Run strProg,maxWindow,blnWait
subcreateProcess
End Sub
Sub subcreateProcess
Dim obj 'uses get method to get win32_process so we can launch new explorer
Set obj = objWMIService.Get("win32_process")
obj.create("explorer.exe")
End sub
End If
WScript.Quit()
AUP.vbs
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
UserName = objShell.ExpandEnvironmentStrings("%USERNAME%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\chandlerb\Desktop\AUP_Files\AUP\" & UserName & ".txt", 2, True)
objFile.Write("*************************************************************" & vbCrLf & vbCrLf)
objFile.Write(UserName & " signed the User Agreement on " & Now & vbCrLf & vbCrLf)
objFile.Write("*************************************************************" & vbCrLf & vbCrLf & vbCrLf)
objFile.Write("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ultrices" & vbCrLf)
objFile.Write("interdum augue ut dictum. Quisque id purus faucibus nunc pulvinar volutpat et" & vbCrLf)
objFile.Write("porta neque. Vestibulum ut pulvinar arcu. Vestibulum scelerisque tempus turpis" & vbCrLf)
objFile.Write("Suspendisse vitae interdum mi. Suspendisse quis nunc sed ipsum sollicitudin" & vbCrLf)
objFile.Write("Morbi vulputate arcu commodo libero volutpat ac suscipit sem tempor. Etiam" & vbCrLf)
objFile.Write("vitae tristique posuere, ante nibh rutrum tortor, eu aliquet velit tellus quis" & vbCrLf)
objFile.Write("sed justo turpis, ut molestie ante. Cras faucibus blandit mauris eget venenatis." & vbCrLf)
objFile.Write("ante magna. Integer vel nibh ut enim iaculis porttitor nec quis turpis. Class" & vbCrLf)
objFile.Write("sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec" & vbCrLf)
objFile.Write("viverra erat eget convallis. Quisque ac libero a tellus condimentum rhoncus at" & vbCrLf)
objFile.Write("Vestibulum vel mauris non sem malesuada pretium cursus id erat. Maecenas et" & vbCrLf)
objFile.Write("Nunc pulvinar, dolor et malesuada consectetur, diam metus tincidunt ipsum, sed" & vbCrLf)
objFile.Write("felis nisi quis metus. Aenean ut mauris eget purus varius luctus. Proin sem" & vbCrLf)
objFile.Write("porta in, iaculis a erat. Phasellus aliquet ipsum felis, et semper ante." & vbCrLf)
objFile.Write("suscipit velit, eget iaculis quam consectetur in. Aliquam erat volutpat" & vbCrLf)
objFile.Write("amet urna ultrices accumsan in in purus. Quisque odio ipsum, fringilla" & vbCrLf)
objFile.Write("vel purus." & vbCrLf)
objFile.Close
答案 0 :(得分:0)
要禁用任务管理器,您应该尝试以下代码:
Call DisableTaskMgr
'-----------------------------DisableTaskMgr-------------------------------------
sub DisableTaskMgr
Dim WshShell,System
System="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
Set WshShell=CreateObject("WScript.Shell")
Wshshell.RegWrite System, "REG_SZ"
WshShell.RegWrite System &"\DisableTaskMgr", 1, "REG_DWORD"
end sub
再次启用它只是你喜欢这样:
Call EnableTaskMgr
'------------------------------EnableTaskMgr-------------------------------------
sub EnableTaskMgr
Dim WshShell,System
System="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
Set WshShell=CreateObject("WScript.Shell")
Wshshell.RegWrite System, "REG_SZ"
WshShell.RegWrite System &"\DisableTaskMgr", 0, "REG_DWORD"
end sub