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). Instructions in this article apply to all (Pro versions and higher) of Windows, including Windows 10.

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 Event Triggers to accomplish the task.

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

Before proceeding, we’ll need NirCmd or Wizmo utility to automate the task of turning 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.

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.

    A new scheduled task is now created, which will be automatically triggered when you lock the workstation using any method.

    automatically turn off monitor when computer is locked

    automatically turn off monitor when computer is locked

  11. 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 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 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, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Leave a Comment