Skip to content

Instantly share code, notes, and snippets.

View channeladam's full-sized avatar

Adam channeladam

View GitHub Profile
@channeladam
channeladam / turn-off-screen.ps1
Created August 1, 2021 05:08 — forked from PCHSwS/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