Skip to content

Instantly share code, notes, and snippets.

@scaery
Created September 8, 2021 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scaery/eacb1595189d3f69658f0947d7cf1cbc to your computer and use it in GitHub Desktop.
Save scaery/eacb1595189d3f69658f0947d7cf1cbc to your computer and use it in GitHub Desktop.
Powershell Script to bypass Screensaver Lockout Policy with jiggling events
<# 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