26 November 2026

Prevent screen saver and lock on Microsoft Windows

Your Windows workstation may lock you out every X minutes of inactivity. This is usually a setting that is enforced company wide for security reasons, just in case you forget to lock the workstation when you walk out of your seat/cubicle/office.

What if you are working from home? Nobody is around and you keep entering your password every time you don't touch the keyboard or mouse for a while.

There are several workarounds, both hardware and software. I found a legit software workaround that works for me. All you need is the powershell interpreter on your machine.

Open a powershell command prompt and launch these two lines: 

$WShell = New-Object -Com "Wscript.Shell"


while (1) {$WShell.SendKeys("{SCROLLLOCK}"); $WShell.SendKeys("{SCROLLLOCK}"); sleep 60}

The second command - if left running - will press twice the "Scroll Lock" key every 60 seconds setting it on and back off. That's enough to trick Windows to think you are hitting keys on your keyboard.

You can still use the Scroll Lock function as it will be toggled fast enough not to be noticeable.