Forum Discussion

musicman58777's avatar
musicman58777
Copper Contributor
Oct 16, 2026

A script to wake up monitors

I'm running Windows 11 Professional 26H2 and I've made two scripts that I put in the taskbar, one of them puts my monitors to sleep and the other one puts my computer to sleep. I just said the command “click” followed by the names of those two scripts and it activates them.
I would like to know how to make a script that will wake the monitors up. Honestly I used copilot to help me write those scripts, but now Microsoft has updated copilot to a female's voice now and I get very little time to speak what I want to it and then it says I've used all my available credits and I think that's a very poor design considering I've been using Windows computers since 3.0 came out and I have never seen a feature be taken away from A Windows operating system.
This is aggravating because I am differently abled and I have brain damage so sometimes I can't explain things the right way and with copilot I used to just be able to speak to it and it would understand me and even show it live video of certain things because I can't always explain what I'm looking at.
I thought that was a very beneficial thing to do to copilot and it's hard to believe that now I have to pay for those features that were free, to me that is poor customer service.
The bottom line is I need somebody to kindly help me write a script that will wake my monitors up please.

 

2 Replies

  • You’ve explained what you need clearly. If only the monitors are asleep and Windows is still running, this script can usually wake them by moving the mouse pointer slightly and then moving it back. It doesn’t click anything.

    Open Notepad and paste this:

    Add-Type @'
    using System.Runtime.InteropServices;
    public static class WakeDisplay {
           [DllImport("user32.dll")]
           public static extern void mouse_event(
                  uint flags, int dx, int dy, uint data, UIntPtr extraInfo);
    }
    '@

    [WakeDisplay]::mouse_event(1, 1, 0, 0, [UIntPtr]::Zero)
    Start-Sleep -Milliseconds 100
    [WakeDisplay]::mouse_event(1, -1, 0, 0, [UIntPtr]::Zero)

    Save it as WakeMonitors.ps1, choosing All files as the file type.

    Create a shortcut with this target, replacing the example path with wherever you saved the script:

    powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\YourFolder\WakeMonitors.ps1"

    Name the shortcut Wake Monitors and pin it to the taskbar, like your existing shortcuts. Try your usual “click Wake Monitors” voice command while the displays are off.

    The important limitation: this cannot wake the whole computer from sleep, because neither the script nor Windows voice control can run while the PC is asleep.

  • You need to wake the displays while leaving the computer running, which is different from waking a sleeping PC. Microsoft documents WM_SYSCOMMAND with SC_MONITORPOWER and an lParam of -1 for powering the display on. If your existing monitor-off script already calls that API, make a separate copy and change only the final power-state argument from 2 to -1. Keep its existing interop declaration and window target, then give the copy a distinct shortcut name that your voice-control setup can recognize. Test while the PC remains awake and the screens are off. This command is not a guarantee for every monitor or driver, and a sleeping PC cannot execute the script until it wakes. If the copy does not work, share the original monitor-off script without personal paths so its exact declaration and calling method can be checked safely.