Lock your PC via a Batch job

I got asked today to see if there was a way that we can get a PC to lock at a given time without any manual intervention. This has came about there has been a new monitoring PC installed on the desk, and this monitoring software has the ability of shutting the application down etc. As there are always people on the desk this is not an issue, but we did not want cleaners etc cleaning the keyboard and causing a problem after we have left for the day.


So this is where I created a very simple batch file, scheduled it within windows using at, this is set for each day (Mon-Fri) at 17:30 it will lock the PC. The code for the batch file is:

 

Rundll32.exe User32.dll,LockWorkStation

 

You can download the batch file here.

 

I am always interested in feedback so feel free to add any comments, or you can mail me  here, also if you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.

Ensure your hard drive is formatted correctly

Play snake on any YouTube clip