Skip to content

Instantly share code, notes, and snippets.

@si-hyeon
Forked from MatthewSteeples/mousemove.ps1
Last active August 11, 2017 08:13
Show Gist options
  • Select an option

  • Save si-hyeon/520e73a65ed831cf09213d94895d8943 to your computer and use it in GitHub Desktop.

Select an option

Save si-hyeon/520e73a65ed831cf09213d94895d8943 to your computer and use it in GitHub Desktop.
Powershell script to keep the mouse moving
# This way works not well for screensaver activated by secure program.
# For preventing screensaver, see https://gist.github.com/si-hyeon/d8430d132bda8c2b1a689c5d11d5a60d
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$pos = [System.Windows.Forms.Cursor]::Position
$x = $pos.X + 1
$y = $pos.Y + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 60
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment