FunctionLock-Screen { [CmdletBinding()] param ( # number of seconds to lock [int] $LockSeconds = 10,
# message shown. Use {0} to insert remaining seconds # do not use {0} for a static message [string] $Title = 'wait for {0} more seconds...',
# dim screen [Switch] $DimScreen )
# when run without administrator privileges, the keyboard will not be blocked!
# get access to API functions that block user input # blocking of keyboard input requires admin privileges $code = @' [DllImport("user32.dll")] public static extern int ShowCursor(bool bShow); [DllImport("user32.dll")] public static extern bool BlockInput(bool fBlockIt); '@