Skip to content

Instantly share code, notes, and snippets.

@nask0
Created April 1, 2025 20:18
Show Gist options
  • Save nask0/7cb21256d36a166fc5e2f1b3da595801 to your computer and use it in GitHub Desktop.
Save nask0/7cb21256d36a166fc5e2f1b3da595801 to your computer and use it in GitHub Desktop.
$MYJOB = Start-Job -ScriptBlock
{
$SLEEPTIME = 5
#$MOVEMENTSIZE = 10
$MOVEMENTSIZE = Get-Random -Minimum 1 -Maximum 128
$WShell = New-Object -Com "Wscript.Shell"
Add-Type -AssemblyName System.Windows.Forms
while ($true) {
$POSITION = [Windows.Forms.Cursor]::Position
$POSITION.x += $MOVEMENTSIZE
$POSITION.y += $MOVEMENTSIZE
[Windows.Forms.Cursor]::Position = $POSITION
$WShell.SendKeys("{SCROLLLOCK}");
Start-Sleep -Seconds $SLEEPTIME
$POSITION = [Windows.Forms.Cursor]::Position
$POSITION.x -= $MOVEMENTSIZE
$POSITION.y -= $MOVEMENTSIZE
[Windows.Forms.Cursor]::Position = $POSITION
$WShell.SendKeys("{SCROLLLOCK}");
Start-Sleep -Seconds $SLEEPTIME
}
}
# To run: PowerShell.exe -NoExit -ExecutionPolicy Bypass -File C:\DontSleep.ps1
@nask0
Copy link
Author

nask0 commented Apr 1, 2025

Keeps Windows machine "awake". For employees that doesn't like to be tracked by their employer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment