All Articles

Caffeinate Your Windows

Your laptop has screen-lock policy. Definitely, it’s a good security practice that the screen locks if you don’t do anything. Yet, always there are situations exceptional. You are doing a presentation and your screen locks while you are talking. You are in a meeting and you have to press keys constantly. It’s distracting and annyoing.

So, you want to and need to caffeinate your machine.

Mac has Amphetamine I know Windows has an app too, but I wrote a simple powershell script in case you can’t install it. Often it’s a case in corporate environment.

param($minutes = 60)

Write-Host "Caffeinating the Screen for $minutes minutes"

$myshell = New-Object -com "Wscript.Shell"
for ($i = 0; $i -lt $minutes; $i++) {
  Start-Sleep -Seconds 60

Write-Host "The caffeine is worn out now"