How to Play the Lock Sound in Windows 10

Every release of Windows since as far back as I can remember (Windows 3.1) has played a welcome sound at startup. In Windows NT-based systems, there is a startup sound as well as separate logon sound. A sound could also play when Windows logs off or when it shuts down. The user could assign all these sounds from Control Panel -> Sound. Starting with Windows 8, sounds for these events have been eliminated almost entirely. Let's see how to play the lock sound in Windows 10.


Why Windows 10 doesn't play the lock sound

In Windows 10, Microsoft focused on making Windows boot and shut down faster. Developers of the OS had completely removed the sounds which play at logon, log off and shutdown. Even if you assign sounds to the events for 'Exit Windows', 'Windows Logon' and 'Windows Logoff' or try to restore these events using the Registry, they will not play. There is the official statement from Microsoft which explains the situation.

"We removed these sound events for performance reasons. We pay a lot of attention to how quickly the machine powers on, powers off, goes to sleep, resumes from sleep, etc.  As part of speeding this up, we experiment a lot with what process is in control of the startup and shutdown sounds. In an interim build of Windows 8 while it was under development, we were able to speed things up considerably by moving the shutdown sound from Explorer.exe (which is running while you’re still logged on) to Logonui.exe (which is the process that shows the "Shutting down" circle.)

However moving the shutdown sound this late started running into other problems. The code we use to play the sound (the PlaySound API) needs to read from the registry (to see what the preferences for this sound were) and from the disk (to read the .wav file), and we ran into issues where the sound was unable to play (or got cutoff halfway) because we had shut down the registry or the disk already!  We could have spent time rewriting the API but we decided the safest and most performant thing to do was to eliminate the sound altogether."

The startup sound

The startup sound remained in Windows 10 but it is disabled by default. You need to enable it manually if required. See the following article:

Enable startup sound in Windows 10

Additionally, Windows 10 comes with a fast startup/hybrid boot feature. Due to this feature, when you click Shut down, it logs you out and hibernates the kernel and powers off; it doesn't really exit Windows. When you turn on your Windows 10 device again, it resumes from hibernate and logs in again. This is different from booting after a full shut down.

Even if you turn on the Windows startup sound, it will only play if you did a full shut down. It never plays when fast startup is on.

The lock sound

Here are instructions to play the Lock sound. This is a sound that Windows plays when you lock your user session/workstation.

The procedure involves several steps. We need to create a special VBScript file which will play the sound, then create a task in Task Scheduler to play it at the lock the workstation event. Here is how.

Create a VBScript File to play the Lock sound

  1. Open Notepad and paste the following lines into it.
    Set oVoice = CreateObject("SAPI.SpVoice")
    set oSpFileStream = CreateObject("SAPI.SpFileStream")
    oSpFileStream.Open "C:\Windows\Media\Windows Unlock.wav"
    oVoice.SpeakStream oSpFileStream
  2. Save this file anywhere with a .VBS extension. For example, "LockSound.vbs".Windows 10 Play Lock Sound Script
  3. Double-click the file you've created and ensure that it plays your sound file.

This is a simple VBScript for Windows to play any sound using the Speech API. I prefer this method because it doesn't depend on loading some slow program such as Windows Media Player or any third-party app to play the sound.

In this script, I am using the default sound file, C:\Windows\Media\Windows Unlock.wav. You can use any file you want. Just modify the appropriate line.

Tip: In the Notepad's Save dialog, include the file name to quotes to ensure that you are saving the file with the VBS file extension and not TXT.Windows 10 Save Lock Sound Script

Now we need to create a special Task Scheduler task to play this sound. Task Scheduler is able to run tasks at lock the workstation event, so specifying our script as the task's action will make it play the sound every time you lock your user session.

Play the Lock Sound in Windows 10

  1. Open Administrative Tools.
  2. Click the Task Scheduler icon.Administrative Tools Control Panel
  3. In the Task Scheduler library, click on the Create Task... link on the right.Windows 10 Create Task Link
  4. In Create Task dialog, fill in the Name box some meaningful text like "Play lock sound".Windows 10 Create Lock Sound Task
  5. Set the option Configure for: Windows 10.Windows 10 Task Options 3
  6. Switch to the Triggers tab and click on the New... button.Windows 10 Triggers Tab
  7. Set the event for the trigger to On workstation lock.Windows 10 Lock Sound Task Trigger
  8. Switch to the Actions tab and click on the New... button.Windows 10 Actions Tab
  9. In the next dialog, set the action type to Start a program.
  10. In the Program box, specify wscript.exe as the program.
  11. Type the full path to your VBScript file into the Add arguments text box.Windows 10 Lock Sound Task Action
  12. Switch to the Conditions tab and disable the option Start the task only if the computer is on AC power.Windows 10 Conditions Tab
  13. Click on the OK button to create the task.

Note: If your operating system is preventing you from saving your task due to a blank password, you can add a password to your user account or disable the restriction in Local Security Policy under Administrative tools.

You are done!

Windows 10 Lock Sound Task Created

This newly assigned sound will play when you lock your computer.

To test the sound in action, just press the  Win + L keys. This will lock your workstation and you should hear the sound.

Windows 10 Lock Screen In Action Original

Tip: For extra sound files, check out the web site. It comes with a large collection of sounds for Windows.

Related articles:

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!


Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

6 thoughts on “How to Play the Lock Sound in Windows 10”

  1. I don’t understand why you use VBS here, but PowerShell in Shutdown sound. Wouldn’t PowerShell be the preferred method, seeing as it’s rather more recent than VBS?

    1. See, VBScript is more “lightweight” and faster.
      However, during the shutdown, VBScript won’t start. It has some permissions issue and cannot create the speech api object. That’s why I used PowerShell.
      So, VBScript is a good idea in most of the cases.

  2. It worked, thanks a lot. I have every one of the sounds that have been done but I haven’t got logoff. I tried to use a tutorial on YouTube but it didn’t work. I’m not saying you have to, but if you can please could you make a tutorial for the logoff sounds sometime in the near future?

Leave a Reply

Your email address will not be published.

Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.