Created
September 8, 2021 19:00
-
-
Save scaery/eacb1595189d3f69658f0947d7cf1cbc to your computer and use it in GitHub Desktop.
Powershell Script to bypass Screensaver Lockout Policy with jiggling events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# mouse-jiggler.ps1 | |
Powershell Script to bypass Screensaver Lockout Policy with jiggling events | |
.____ .__ | |
| | ____ | | ______ ____ ____ | |
| | / _ \| | / ___// __ \_/ ___\ | |
| |__( <_> ) |__\___ \\ ___/\ \___ | |
|_______ \____/|____/____ >\___ >\___ > | |
\/ \/ \/ \/ | |
#> | |
param($sleep = 60) # seconds | |
$announcementInterval = 1 # loops | |
Clear-Host | |
$WShell = New-Object -com "Wscript.Shell" | |
$date = Get-Date -Format "dddd MM/dd HH:mm (K)" | |
$stopwatch | |
try { | |
$stopwatch = [system.diagnostics.stopwatch]::StartNew() | |
} catch { | |
Write-Host "Couldn't start the stopwatch." | |
} | |
Write-Host "Take care if you leave the room! LoL o_O" | |
$index = 0 | |
while ( $true ) | |
{ | |
$WShell.sendkeys("{SCROLLLOCK}") | |
Start-Sleep -Milliseconds 200 | |
$WShell.sendkeys("{SCROLLLOCK}") | |
Start-Sleep -Seconds $sleep | |
# Announce runtime on an interval | |
if ( $stopwatch.IsRunning -and (++$index % $announcementInterval) -eq 0 ) | |
{ | |
Write-Host "Elapsed time: " $stopwatch.Elapsed.ToString('dd\.hh\:mm\:ss') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment