ChristianDavies Posted August 15, 2013 Posted August 15, 2013 Hi All, I have created an exam environment user interface script that also kills the explorer task and removes task manager etc.. however you are able to close the UI using ALT+F4 and once you have done this you can't do anything at all (not even log off). You have to manually reboot the machine. Is it possible to disable ALT+F4 for a security group? I wan't to avoid regedit unless it can be used for a security group on its own and doesn't affect the machine after the exam user is logged off. Any help appreciated. Cheers.
Guest Guest Posted August 15, 2013 Posted August 15, 2013 Probably best to make the application the shell, then it should reopen should they close it. Also that way explorer never runs. Doable using GPO/GPP
ChrisMiles Posted August 15, 2013 Posted August 15, 2013 No, it is not. Alt-F4 is the windows shortcut key for closing an application, it is handled by the application and can only be disabled by a specific application. What I suggest is instead of running your "exams" software directly, create a batch file that runs the exams software using start /wait and then afterwards run logoff.exe to log off the user. Oooor you could write a batch file with a never-ending loop which runs the application again if it is executed. The run this batch file instead.
ChristianDavies Posted August 15, 2013 Author Posted August 15, 2013 That's a good idea, at the moment I have a batch script that runs on logon and a kix sctipt that starts the software and kills explorer.exe so maybe an if statement for if the file is closed it should run again?
ChrisMiles Posted August 15, 2013 Posted August 15, 2013 That's a good idea, at the moment I have a batch script that runs on logon and a kix sctipt that starts the software and kills explorer.exe so maybe an if statement for if the file is closed it should run again? Im not a kix expert but im sure you can make the kix script wait for the program to finish executing when you run it somehow.
ChristianDavies Posted August 15, 2013 Author Posted August 15, 2013 I'll have a look into it tomorrow morning, might be back
Arthur Posted August 15, 2013 Posted August 15, 2013 It's really easy to completely disable Alt + F4 with the following AutoHotkey script. NoAltF4.ahk #NoTrayIcon !F4::Return If you compile the script to an EXE (right-click the AHK file » Compile Script), all you have to do is run it when the users login and they won't be able to close any programs with Alt + F4. 1
ChrisMiles Posted August 15, 2013 Posted August 15, 2013 It's really easy to completely disable Alt + F4 with the following AutoHotkey script. NoAltF4.ahk #NoTrayIcon !F4::Return If you compile the script to an EXE (right-click the AHK file » Compile Script), all you have to do is run it when the users login and they won't be able to close any programs with Alt + F4. # Nice! Good one m8. I assume it blocks the windows message chain or something? Probably need to run this 1st?
Arthur Posted August 15, 2013 Posted August 15, 2013 I assume it blocks the windows message chain or something? Yeah. As long as the script is running, the key combo gets intercepted. Probably need to run this 1st? You only have to install AutoHotkey on your PC in order to compile the .ahk script into an EXE. Once that is done, it can be run via a login script, the HKLM 'Run' key below, or another method. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "NoAltF4"="C:\\Scripts\\NoAltF4.exe" Another way to disable Alt + F4 would be to modify the keyboard scan code map in the registry on each PC they are doing exams on. The following .reg file and PowerShell script both do this, although you could also use Group Policy Preferences to deploy the Scancode Map. NoAltF4.reg Windows Registry Editor Version 5.00 ; Disable Left & Right ALT keys and F4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00,00,00,00,00,04,00,00,00,00,00,3e,00,00,00,38,00,\ 00,00,38,e0,00,00,00,00 or NoAltF4.ps1 # Disable Left & Right ALT keys and F4 Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -name "Scancode Map" -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0xe0,0x00,0x00,0x00,0x00)) These will disable Alt + F4 for every user who logs onto that PC. For the changes to take effect, reboot the computer. To re-enable Alt + F4 simply delete the "Scancode Map" registry value and reboot again. 1
ChristianDavies Posted August 16, 2013 Author Posted August 16, 2013 Brilliant! It works! Just added a line in my VB Script that says: WshShell.Run("\\ad1\NETLOGON\NoAltF4.exe") Cheers!
Ruggy Posted November 4, 2020 Posted November 4, 2020 Thanks so much for this info. I was able to add the noALTF4 prior to running a game. How would I re-enable the ALT+F4 once I exit out of the game/program beside reboot the PC?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now