發表文章

目前顯示的是 1月, 2023的文章

Prevent Screen Saver from idle ten minute with power shell script

Clear-Host Echo "Keep-alive with mouse Jitter..." Add-Type -AssemblyName System.Windows.Forms while($true) {     $mouse_position = [System.Windows.Forms.Cursor]::Position $x = ($mouse_position.X % 1024) + 1 $y = ($mouse_position.Y % 1024) + 1 [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x,$y) Start-Sleep -Seconds 300 } #@combine mouse jitter and scroll lock Clear-Host Echo "Keep-alive with mouse Jitter and scroll lock..." Add-Type -AssemblyName System.Windows.Forms $wsshell = New-Object -com "Wscript.Shell" while($true) {     $mouse_position = [System.Windows.Forms.Cursor]::Position $x = ($mouse_position.X % 1024) + 1 $y = ($mouse_position.Y % 1024) + 1 [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x,$y) Start-Sleep -Seconds 59 $wsshell.sendkeys("{SCROLLLOCK}") Start-Sleep -Milliseconds 59000 $wsshell.sendkeys("{SCROLLLOCK}") Start