How to mute a Windows PC automatically when it gets locked - gHacks Tech News

How to mute a Windows PC automatically when it gets locked

Locking a PC can be useful to protect it from being accessed by bystanders while you are away. If you take a break in a work environment for instance, it is always a good idea -- and often company policy -- to lock the PC in question during that time.

While it is easy to lock a Windows PC, the keyboard shortcut Windows-L does that, the locking won't really affect programs running on it.

This means that any sound that plays at the moment continues to play when the device is locked. Again, this can be easily resolved by either stopping the sound manually each time before you lock the PC, by using headsets as it does not really matter in this case.

You may prefer an automated solution on the other hand as it is convenient once set up.

Here is what you need for that:

  1. The excellent NirCmd which we will use to trigger the functionality when you lock the computer.
  2. A new task in Windows' Task Scheduler.

Setting it all up

The first thing you may want to do is download and extract NirCmd on the system. You do not need to do anything else with it, just remember the path it is located on as we need that later on.

Open the Windows Task Scheduler next. You can do so by loading a run box with Windows-r, typing taskschd.msc and hitting the enter key.

Or use the search functionality of your operating system and search for Task Scheduler which should also work just fine.

Select Create Task from the actions menu on the right.

Add a name and if you want a description for the task on the general tab that opens up.


Switch to the triggers tab next. Here you need to create two triggers, as you want to mute the sound when you lock the workstation, and unmute it when you unlock it again.

If you only want it muted automatically, you only need to create a single trigger here.

Select new and select on workstation lock and for the next trigger on workstation unlock and leave every other setting as is.

on wokstation lock

Switch to the actions tab afterwards and click on the new button here. Keep start a program as the action, and browse to the nircmd.exe script on the PC's hard drive.

Add mutesysvolume 2 as the argument and click on ok afterwards.


The command toggles between mute and unmute state of the sound on the system. You find additional examples on the Nirsoft website. The command nircmd.exe mutesysvolume 1  will mute the volume for instance but not unmute it at a later point in time.

NirCmd is compatible with all supported versions of the Microsoft Windows operating system.

How to mute a Windows PC automatically when it gets locked
Article Name
How to mute a Windows PC automatically when it gets locked
How to mute all sounds when you lock a Windows PC, and how to unmute the volume again when the device gets unlocked again.

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Previous Post: «
Next Post: »


  1. Seban said on May 31, 2014 at 2:04 am

    Nice article. Thanks.

    Until today I only used “path/nircmd.exe mutesysvolume 1” to mute before going into hibernation via TOff. Your solution seems much better.

  2. George P. Burdell said on May 31, 2014 at 7:42 pm

    Martin, you have done another fine job of describing a useful command. Thank you!

    When I wanted to learn more, I read the entire web site, which looks like a cornucopia of worthwhile software.

    Then I looked into the Windows Task Scheduler taskschd.msc.

    Lots of undesirable tasks with innocent sounding names are running all the time doing who knows what! One that caught my eye is MirageAgent, which apparently turns on my video camera and shares what it sees with anyone who asks. That one is going to get nullified right away. There are so many more tasks that it will take a month to stamp out all the cockroaches in that kitchen.


  3. Jason said on February 18, 2016 at 3:36 pm

    Thank you for this great article! One suggested correction: a more appropriate command may be
    “nircmd.exe mutesysvolume 1” because this will mute the volume when the screen is locked, no matter what state the volume was in to begin with. The command you have recommended, “nircmd.exe mutesysvolume 2” will toggle the volume off or on, so this means that if the volume was muted at the time the screen was locked, then locking the screen will actually turn the volume on while you are away from your computer.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.

Be polite: we do not allow comments that threaten or harass, or are personal attacks. Please leave politics and religion out of discussions!