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.

create-task

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.

mute-system

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.

Summary
Article Name
How to mute a Windows PC automatically when it gets locked
Author
Description
How to mute all sounds when you lock a Windows PC, and how to unmute the volume again when the device gets unlocked again.
Please share this article

facebooktwittergoogle_plusredditlinkedinmail


Responses to How to mute a Windows PC automatically when it gets locked

  1. Seban 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 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 nirsoft.net 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.

    References:

    http://answers.microsoft.com/en-us/windows/forum/windows_vista-performance/what-is-mirageagent-in-task-scheduler/556cd70f-52a8-4e1d-a9e0-805a9a82d905

    http://www.shouldiremoveit.com/CyberLink-YouCam-6787-program.aspx

Leave a Reply