Automatically Turn off Monitor when you Lock your Computer

We saw how to turn off your monitor or put your computer to sleep mode using shortcuts. Also, we explained how to automatically lock the workstation immediately after automatic login to your account.

By default, after you lock your workstation (computer), the display turns off automatically in 1 minute, and the lock screen display off timeout can only be increased. For some users, the 1-minute interval is not sufficient, and they need a mechanism to automatically turn off the monitor immediately after the computer is locked.

In this article, we’ll see how to automatically turn off the monitor automatically when you lock your computer (Win + L).

Automatically Turn off Monitor when you Lock your Computer

Turning off monitor & locking the workstation can be automated using a Windows Batch file. But it won’t help if the computer locks automatically after the screensaver or Sleep timeout. So, we’ll see how to use Task Scheduler Trigger to accomplish the task.

Note: Before proceeding, we’ll need NirCmd or Wizmo utility that can turn off the monitor. Check out the article How to Turn Off Monitor Using Shortcut or Command-line in Windows for a brief overview of these tools and their download links.

Method 1: Using Task Scheduler

This is the preferred method.

  1. Launch Task Scheduler and click on the Create Task option.
  2. Assign a name and description for the task.
  3. Click on the Triggers tab, and click New…
  4. From the dropdown, select On workstation lock, and click OK.
    turn off monitor when locking computer

    turn off monitor when locking computer

  5. Click on the Actions tab, and click New…
  6. In the Program/script: box, type in the path to nircmd.exe
    turn off monitor when locking computer
  7. In the arguments box, type monitor off as the arguments and click OK, OK.

A new scheduled task is now created, which triggers nircmd.exe monitor off command automatically when you lock the computer.


Method 2: Using Audit & Task Scheduler

Here is another way to turn off the monitor automatically, but this is not the preferred method. Windows Pro versions have the Local Security Policy Editor which allows you to audit logon events. First, enable auditing of successful account logon events via Security Policy console. After you enable auditing, every login, logoff, lock and unlock workstation events are recorded in the Windows Event log. In Step 2, we’ll attach a scheduled task for the “lock workstation” event.

Step 1: Enable audit of logon events

  1. Open the Local Security Policy (secpol.msc) console.
  2. Expand Security Settings → Local Policies → Audit Policy
  3. Double-click Audit logon events
    automatically turn off monitor when computer is locked
  4. Enable the checkbox for Success, and click OK.
    automatically turn off monitor when computer is locked
  5. Exit Local Security Policy console.

Step 2: Create an Event Trigger for “Lock Workstation” event

After you enable auditing as in Step 1, workstation lock events are recorded in the Security event log as Event ID: 4800. (Unlock workstation event has ID 4801)



  1. Lock the workstation once using Winkey + L and then unlock it.
  2. Open Event Viewer (eventvwr.msc)
  3. Expand Windows logsSecurity
  4. In the middle pane, locate the recent event having the ID 4800.
    automatically turn off monitor when computer is locked
  5. Right-click on the event, and click Attach Task To This Event
    automatically turn off monitor when computer is locked
  6. In the next screen, assign a name for the scheduled task and click Next.
    automatically turn off monitor when computer is locked
  7. In the next screen, the Event ID and source are automatically filled up. Click Next.
    automatically turn off monitor when computer is locked
  8. In the Action window, click Start a program, and click Next.
    automatically turn off monitor when computer is locked
  9. In the Program/script: box, type in the path to nircmd.exe
    automatically turn off monitor when computer is locked
  10. In the arguments box, type monitor off as the parameters and click Next.
    automatically turn off monitor when computer is locked
    automatically turn off monitor when computer is locked

A new scheduled task is now created, which will be automatically triggered when you lock the workstation using any method. The new task is stored under Task Scheduler LibraryEvent Viewer Tasks in Task Scheduler. This is because the above task was created via Event Viewer Attach Task To This Event (a.k.a. Event Trigger) option.

Editor’s note: After some time, if you think you no longer want to turn off the monitor when locking the computer, reverse the steps listed under “Step 1” so that your Security event log is not flooded with login/logoff/lock/unlock workstation events. Then, manually delete the scheduled task using Task Scheduler.


Lock Workstation & Turn off Display using Windows Batch file

You can also use a Windows Batch file to lock your workstation & turn off the monitor in a single click. Again, you’ll need NirCmd or Wizmo.

Create a Batch file (say, lock-and-turn-off-monitor.bat) using Notepad with the following contents:

RunDll32.exe user32.dll,LockWorkStation
C:\Windows\nircmd.exe monitor off

Running the Batch file will accomplish the task!

That’s it! Press Winkey + L to lock the workstation now. It will automatically trigger your “Turn off monitor” scheduled task, and your monitor(s) will now turn off automatically!


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

5 thoughts on “Automatically Turn off Monitor when you Lock your Computer”

  1. Monitor turns off when I execute the PS line in console.
    Monitor turns off when I execute script containing the PS line.

    Monitor does not turn off when I “Run” task whose Action is to run that script. (Yes, “Allow… on demand”.)
    “Last Run Result” is “…successfully”; the task ran.
    To no effect.

    Reply
  2. This is much more complicated than necessary. Instead of the additional steps, not to mention the extra logging it necessitates, of enabling the auditing and using that, just create a scheduled task with an event trigger and select “On workstation lock…”

    Reply
  3. Thanks!!!
    Other charge $6.78 for 3 month for a software to turn monitor off!
    turnoffmonitor . com/activation.htm
    Looks like a windows 10 freeware tool on the start page but after a while …

    P.S. Method 1 just worked on my computer after a restart.

    Reply

Leave a Comment