mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 20:44:17 +01:00
21 lines
415 B
PowerShell
21 lines
415 B
PowerShell
|
<#
|
||
|
.SYNOPSIS
|
||
|
Locks the desktop
|
||
|
.DESCRIPTION
|
||
|
This PowerShell script locks the local computer desktop immediately.
|
||
|
.EXAMPLE
|
||
|
PS> ./lock-desktop
|
||
|
.LINK
|
||
|
https://github.com/fleschutz/PowerShell
|
||
|
.NOTES
|
||
|
Author: Markus Fleschutz | License: CC0
|
||
|
#>
|
||
|
|
||
|
try {
|
||
|
"Bye bye."
|
||
|
rundll32.exe user32.dll,LockWorkStation
|
||
|
exit 0 # success
|
||
|
} catch {
|
||
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||
|
exit 1
|
||
|
}
|