rundll32.exe user32.dll, LockWorkStation)
if ($args[1] -is [int]) { $nb = $args[1] Write-Output "Locking screen in $nb seconds" Start-Sleep -Seconds $nb $lockscreen = $(rundll32.exe user32.dll, LockWorkStation) $lockscreen }