A simple PowerShell script to reliably control monitor/display state.
This uses the same method as when a computer display times out through normal power settings. Unlike tools like ControlMyMonitor that change monitor hardware settings and actually power off the monitor, this script uses Windows messaging to place displays into standby (not a full power-off) and runs entirely in PowerShell with no external dependencies. You can wake the screens manually by moving the mouse or pressing a key and allowing a few seconds for them to resume, or wake them remotely through the script.
Use -TurnOff to put displays into standby, or -TurnOn to wake them.
# Turn monitors off
& '.\Screen Controller.ps1' -TurnOff
# Wake monitors
& '.\Screen Controller.ps1' -TurnOn
# Turn monitors off on a Modern Standby device you have tested (see below)
& '.\Screen Controller.ps1' -TurnOff -ForceOr if calling from cmd:
:: Turn monitors off
powershell.exe -ExecutionPolicy Bypass -File ".\Screen Controller.ps1" -TurnOff
:: Wake monitors
powershell.exe -ExecutionPolicy Bypass -File ".\Screen Controller.ps1" -TurnOnRMM platforms usually pass script variables as environment variables. The script reads these so you can expose them as a dropdown and a checkbox instead of editing the command line:
| Variable | Values | Equivalent |
|---|---|---|
action |
Turn On or Turn Off |
-TurnOn / -TurnOff |
force |
true or 1 |
-Force |
The switches still work when run by hand.
- TurnOff: Uses Windows messaging to place all connected monitors into standby (not just a black screensaver). The computer itself stays awake and on the network.
- Skipped on laptops and tablets, since the script is intended for desktops driving monitors.
- Skipped on Modern Standby devices, where turning the displays off can put the whole device into standby and drop the network. See Modern Standby below for how to fix this or bypass the check.
- TurnOn: Nudges the mouse 1 pixel and back, then uses Windows messaging to bring the displays back on. No keys are pressed to wake the screens.
- After waking, the script checks which window is in front. If Windows is showing the lock screen image (time and date, no sign-in required yet), it sends a single Ctrl key press to dismiss it.
- If the desktop is already showing, or the real sign-in screen is up, nothing is sent.
On a classic S3 desktop, turning the displays off only turns the displays off. On a Modern Standby (S0 Low Power Idle) device, the screen going off is the entry point to standby. The device then drifts into its low-power idle state, Win32 apps such as RMM agents get throttled, and remote sessions drop. Most laptops and most business desktops sold since 2022 ship this way, so the script skips those devices by default and prints how to fix it.
Check which mode a device is in:
powercfg /aIf Standby (S0 Low Power Idle) is listed as available, the device uses Modern Standby.
Disable it. Run as an administrator, then reboot:
-
If the BIOS offers it, switch the sleep state to S3:
- Dell: BIOS (F2 at boot) > Power (older BIOS: Power Management) > Sleep Mode = Force S3. Or, with Dell Command | Configure installed:
cctk.exe --sleepmode=forces3 - Lenovo: BIOS > Config > Power > Sleep State = Linux S3
- HP: BIOS > Advanced > Power Management > disable Modern Standby / enable S3 (not all models)
- Dell: BIOS (F2 at boot) > Power (older BIOS: Power Management) > Sleep Mode = Force S3. Or, with Dell Command | Configure installed:
-
Windows decides between S3 and Modern Standby at install time and may not pick up the BIOS change on its own. Set the registry override as well:
reg add HKLM\SYSTEM\CurrentControlSet\Control\Power /v PlatformAoAcOverride /t REG_DWORD /d 0 /f
After the reboot, powercfg /a should no longer list S0 Low Power Idle as available. It may report no sleep states at all. That is fine for a desktop that should never sleep: the machine cannot drop into standby, so the displays can go off while it stays awake and reachable.
Or bypass the check. -Force skips the Modern Standby check and turns the displays off anyway. Only use it on a device you have tested and confirmed stays reachable with the displays off for 15 to 20 minutes. When -Force is set the script still runs the check and tells you whether the bypass was actually needed. The laptop/tablet check still applies.
Set up with Task Scheduler, Group Policy Preferences, or an RMM to automatically:
- Turn monitors off at 6 PM
- Wake monitors at 6 AM
Well suited to unattended desktops such as check-in computers and lobby displays.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Bad arguments (specify exactly one of -TurnOn or -TurnOff) |
| 2 | The display command failed |
| 3 | No interactive user session (running as SYSTEM or non-interactive) |
| 4 | Skipped (laptop/tablet or Modern Standby device) |
- Windows 10/11
- PowerShell 5.1 or later
- Must run in the context of a logged-in user (interactive session), not as SYSTEM. In Task Scheduler, choose "Run only when user is logged on". In RMM, run as the current logged-on user.
Updated 2026-10-06
SC_MONITORPOWERvalue (-1instead of0)SMTO_ABORTIFHUNG)-TurnOfffrom a console no longer wakes the screens straight away when you let go of Enter-TurnOnnow wakes the screens with a 1-pixel mouse nudge instead of a Shift key press-TurnOndetects the time and date lock screen after waking and dismisses it with a single Ctrl press. Nothing is sent if the desktop or the real sign-in screen is showing-TurnOffskips laptops, tablets and Modern Standby devices, where the whole device could go into standby and drop off the network