How to Play the Unlock Sound in Windows 10

Music Mute Sound Volume Speaker Audio Player Icon 256 04

Recently, we saw how to make Windows 10 play the Lock sound. Today we will make the OS play the unlock sound. The similar trick can be used to revived the missing feature in Windows 10. Here we go.

Every release of Windows has played sounds for various events. In Windows NT-based systems, there was a startup sound as well as separate logon sound, along with shutdown, lock/unlock and logoff sounds. The user could assign all these sounds from Control Panel -> Sound. Starting with Windows 8, sounds for these events have been eliminated almost entirely.

Why Windows 10 doesn't play the sounds

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 unlock sound

Here are instructions to play the Unlock sound. This is a sound that Windows plays when you unlock 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, "UnlockSound.vbs".
  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.

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

Play the Lock Sound in Windows 10

  1. Open Administrative Tools.
  2. Click the Task Scheduler icon.
  3. In the Task Scheduler library, click on the Create Task... link on the right.
  4. In Create Task dialog, fill in the Name box some meaningful text like "Play Unlock sound".
  5. Set the option Configure for: Windows 10 as shown above.
  6. Switch to the Triggers tab and click on the New... button.
  7. Set the event for the trigger to On workstation unlock.
  8. Switch to the Actions tab and click on the New... button.
  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.
  12. Switch to the Conditions tab and disable the option Start the task only if the computer is on AC power.
  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!

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 work your workstation.

Now, unlock it. You should hear the sound.

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.

2 thoughts on “How to Play the Unlock Sound in Windows 10”

  1. This comment is irrelevant to this topic.
    Can you make a post to how to completely customize synaptics touchpad, there are more options in register editor than the options in synaptics control panel.

Leave a Reply

Your email address will not be published.

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