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
- 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 oSpFileStream.Close
- Save this file anywhere with a .VBS extension. For example, "UnlockSound.vbs".
- 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
- Open Administrative Tools.
- Click the Task Scheduler icon.
- In the Task Scheduler library, click on the Create Task... link on the right.
- In Create Task dialog, fill in the Name box some meaningful text like "Play Unlock sound".
- Set the option Configure for: Windows 10 as shown above.
- Switch to the Triggers tab and click on the New... button.
- Set the event for the trigger to On workstation unlock.
- Switch to the Actions tab and click on the New... button.
- In the next dialog, set the action type to Start a program.
- In the Program box, specify wscript.exe as the program.
- Type the full path to your VBScript file into the Add arguments text box.
- Switch to the Conditions tab and disable the option Start the task only if the computer is on AC power.
- 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 WinSounds.com web site. It comes with a large collection of sounds for Windows.
- How to Play the Logon Sound in Windows 10
- How to Play the Lock Sound in Windows 10
- Enable startup sound in Windows 10
- How to Play the Shutdown Sound in Windows 10(not reliable method)
- How to lock Windows 10 and turn off the display with one click
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options: