Open up Task Scheduler: I called the task lockscreen. See below.

On the Trigger I've selected idle. I've set the task to repeat every 10 minutes.

Actions - Start an program. The path is C:\Windows\System32\rundll32.exe Add the arguments: user32.dll, LockWorkStation

Conditions. Start the task only if the computer is idle for how ever many minutes you want. I selected 1 minute.

Settings: Configure any additional settings and be on your way.