Skip to content

Instantly share code, notes, and snippets.

@PCHSwS
PCHSwS / turn-off-screen.ps1
Created April 18, 2021 16:45 — forked from oledid/turn-off-screen.ps1
PowerShell: Turn off computer screen
# Source: http://www.powershellmagazine.com/2013/07/18/pstip-how-to-switch-off-display-with-powershell/
# Turn display off by calling WindowsAPI.
# PostMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_MONITORPOWER, POWER_OFF)
# HWND_BROADCAST 0xffff
# WM_SYSCOMMAND 0x0112
# SC_MONITORPOWER 0xf170
# POWER_OFF 0x0002