Little helper scripts - Part 1: no-screenlock-during-meeting.ps1
Photo by Markus Spiske: https://www.pexels.com/photo/internet-technology-computer-display-360591/
I decided to make some posts about smaller helper scripts I created. Just to brag about them. 😁 Well.. And maybe they help others solve a problem of their own too or serve as inspiration.
First script in this series is my: no-screenlock-during-meeting.ps1 (GitHub)
As the file extension reveals it's a Powershell script. It use is to press the ScrollLock key every 280 seconds. This effectively prevents Windows from automatically locking the screen after 5 minutes of inactivity.
I came up with this rather quickly as this seems to be a non-changeable standard setting of all clients I was working at so far. And yes, that setting makes sense and really enhances workplace security. I don't argue that.
However.. When you are in a meeting and easily spent several minutes listening, watching a demo/presentation or discuss topics.. Those 5 minutes are up rather quickly. And I got annoyed of constantly typing in my password when I just wanted to add 1-2 small sentences to my meeting notes.
This is what this script is for. It even checks if the computer is locked already and doesn't press a key if it is. As I also got annoyed of my laptop screen activating when locked and showing the password prompt every time the script would press a key.
But you have to keep in mind: I only use this script when I am in front of my laptop. Therefore I deemed this to be okay - if used in a responsible manner. As yes, I am circumventing a clients security measure. This is something you have to keep in mind. If I mess up by using this script - for example by keeping it running and leaving the room - my fault, my responsibility.
The script can be found on GitHub here: https://github.com/ChrLau/scripts/blob/master/no-screenlock-during-meeting.ps1
# If the computer isn't locked:
# Press the Scrolllock-Key every 280 seconds to prevent the automatic screen locking
$WShell = New-Object -Com "Wscript.shell"
while (1) {
# Check if the logonui process is running - which is only the case when the Lockscreen is up
if ( Get-Process logonui -ErrorAction SilentlyContinue ) {
# Computer is locked, do nothing
} else {
# Computer is unlocked, press SCOLLLOCK key
$WShell.SendKeys("{SCROLLLOCK}");
}
# Sleep for 280 seconds
sleep 280;
}
I gladly take improvements as comment here or merge request on GitHub. Or just send a link to your version and I'll copy over the stuff I deem useful. 😜