Skip to content

Instantly share code, notes, and snippets.

@telepyzuk
Forked from MatthewSteeples/mousemove.ps1
Last active January 19, 2024 07:44
Show Gist options
  • Select an option

  • Save telepyzuk/6a3ee9243116c97b0a5294466b96ff22 to your computer and use it in GitHub Desktop.

Select an option

Save telepyzuk/6a3ee9243116c97b0a5294466b96ff22 to your computer and use it in GitHub Desktop.
Powershell Script to keep the mouse moving
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X % 500) + 1
$y = ($pos.Y % 500) + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 10
}
param($minutes = 60)
$myshell = New-Object -com "Wscript.Shell"
for ($i = 0; $i -lt $minutes; $i++) {
Start-Sleep -Seconds 60
$myshell.sendkeys(".")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment