Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2)
Copy link

This shuts off the screen and locks the desktop. Would be nice if there was a way to just shutoff the screen.

AFAIK, the Windows OS will wake the screen on any KB or mouse event, and will bring you to the unlock screen (or desktop if security is disabled).

Copy link

Shazib commented Apr 10, 2023

Is this still working for you guys? for me the screen turns off then immediatley turns back on - no mouse or keyboard movements (by me)...

Copy link

Can confirm that it works for me with Windows 10 Pro 22H2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment