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.
- Launch Task Scheduler and click on the Create Task option.
- Assign a name and description for the task.
- Click on the Triggers tab, and click New…
- From the dropdown, select On workstation lock, and click OK.
- Click on the Actions tab, and click New…
- In the Program/script: box, type in the path to
nircmd.exe
- 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
- Open the Local Security Policy (
secpol.msc
) console. - Expand Security Settings → Local Policies → Audit Policy
- Double-click Audit logon events
- Enable the checkbox for Success, and click OK.
- 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
)
- Lock the workstation once using Winkey + L and then unlock it.
- Open Event Viewer (
eventvwr.msc
) - Expand Windows logs → Security
- In the middle pane, locate the recent event having the ID 4800.
- Right-click on the event, and click Attach Task To This Event
- In the next screen, assign a name for the scheduled task and click Next.
- In the next screen, the Event ID and source are automatically filled up. Click Next.
- In the Action window, click Start a program, and click Next.
- In the Program/script: box, type in the path to
nircmd.exe
- 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. The new task is stored under Task Scheduler Library → Event 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!
Great post my man, thank you very much!
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.
@x: Have you enabled Audit logon events?
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…”
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.