While the rundll32.exe etc. version works, but since sending keystrokes does not require a keyboard physically to be present (it does not use the hardware, it sends keypress messages), the WIN+L is method shall work just as well (and a bit more readable).