Add-Type -MemberDefinition @'
[DllImport("user32.dll")] public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")] public static extern bool GetCursorPos(out POINT lpPoint);
public struct POINT { public int X; public int Y; }
'@ -Name NativeMethods -Namespace Win32
while ($true) {
$p = New-Object Win32.NativeMethods+POINT
[Win32.NativeMethods]::GetCursorPos([ref]$p)
[Win32.NativeMethods]::SetCursorPos($p.X + 1, $p.Y)
Start-Sleep -Milliseconds 50
[Win32.NativeMethods]::SetCursorPos($p.X, $p.Y)
Start-Sleep -Seconds 60
}