Today I received weird request from one of my developer friend, He created some application but whenever screen was getting locked due to screen saver lock Group Policy after designated time, Application was not working as expected, Until he resolve the bugs in his application he was seeking help if there is any possibility that server won't get automatically locked due to screen saver policy, And I also need not to make any changes to group policy for single this single PC.
For this below is the small PowerShell Script, Which sends keyboard key NUMLOCK twice on the screen after every 60 seconds, which doesn't allow to lock the screen.
To run this script, copy it to notepad and save it as .PS1 extension using double quotes,
Once saved it in ps1 file. Run it using cmd with below one liner command.
PowerShell -NoProfile -File c:\temp\nolock.ps1 -ExecutionPolicy Unrestricted
I have added one more code for fun once run below code on the screen it shows some cool random colors on the screen. Same is in the script.