Disclaimer: Using a script that simulates activity to avoid being marked as "away" or "AFK" on your computer may be against the policies of your organization or the services you're using. It is important to adhere to the rules and guidelines set by your employer or the platform you're using.
If you are looking to prevent your computer from entering sleep mode or locking the screen due to inactivity, you can simply adjust the power and sleep settings in Windows.
However, if you still want a simple PowerShell script to move the mouse cursor periodically, here it is. Please use it responsibly and only for legitimate purposes.
- Open a text editor, such as Notepad.
- Copy and paste the provided code into the text editor.
- Save the file with the ".ps1" extension, for example, "StayActive.ps1".
- Right-click on the saved file and select "Run with PowerShell".
The script will move the mouse cursor by 1 pixel every 4 minutes to simulate activity. To stop the script, close the PowerShell window or press Ctrl+C
in the PowerShell console.
Use this script responsibly and within the boundaries of the rules set by your organization or the services you are using.