If you are about to launch a lengthy automation script, why not turn off the display right away instead of waiting for the screen saver timeout to kick in?
Here is a simple function that turns off your display immediately. Just move the mouse or press a key to turn it back on:
$code = @"
public class API
public static extern
int SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
$t = Add-Type -TypeDefinition $code -PassThru
$t::SendMessage(0xffff, 0x0112, 0xf170, 2)
ReTweet this Tip!
OK, from a pure risk management perspective. Why just blank the display and leaving the computer logged on potentially running code using a highly privilege account that someone can just walk up and well, you know. Why not lock the system instead with this native Windows OS one-liner in your script.
Of course, one could wrap that in a function as well.