-
Notifications
You must be signed in to change notification settings - Fork 15
Auto lock unlock Windows
Yukino Song edited this page Oct 8, 2024
·
2 revisions
Add the following scripts to Global Prepare Commands:
Do:
powershell -NoProfile -ExecutionPolicy unrestricted -Command "if (tasklist | findstr -i logonui) { tsdiscon ((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; Start-Sleep 1; tscon ((quser $env:USERNAME | select -Skip 1) -split '\s+')[1] /dest:console; New-Item -Path '$env:TEMP\apollo_unlock.lock' -ItemType File -Force; exit 1; }"
Undo:
powershell -NoProfile -ExecutionPolicy unrestricted -Command "if (Test-Path '$env:TEMP\apollo_unlock.lock') { if ((Get-Item '$env:TEMP\apollo_unlock.lock').CreationTime -lt (Get-Date).AddSeconds(-1)) { rundll32.exe user32.dll, LockWorkStation } } else { rundll32.exe user32.dll, LockWorkStation }"
Elevated
needs to be checked.
Warning
Make sure you have disabled Launch Apps
permission for untrusted clients, as this script can unlock your computer without a password.
The command will try to unlock the computer when you start streaming, and lock the computer once you exit your program. When unlocked, you'll disconnect from the stream, then you can strat streaming again and you'll be connected in unlocked state.