How to Play Sound when Lock Computer in Windows
Locking your PC protects it from unauthorized use when you need to step away from the PC, and don't want to sign out or shut down.
When you lock the computer, you will be taken to the lock screen by default to unlock and sign in when ready to continue where you left off. Other users can still sign in to their accounts from the sign-in screen.
If you like, you can still create an elevated task to play a sound when users lock the computer.
This tutorial will show you how to play a sound when users lock the computer in Windows 7, Windows 8, Windows 10.
You must be signed in as an administrator with a password to create an elevated task.
Contents
- Option One: Add or Remove Play a Sound when Lock Computer Task Automatically using a BAT file
- Option Two: Add or Remove Play a Sound when Lock Computer Task Manually in Task Scheduler
Special thanks to Matthew for providing the .bat files in this option.
1 Do step 2 (add) or step 3 (remove) below for what you would like to do.
A) Download the Play_Sound_when_Lock_Computer.bat file below to your desktop.
B) Unblock the downloaded .bat file.
C) Run the .bat file.
D) If prompted by UAC, click/tap on Yes to approve running the .bat file elevated (run as administrator).
E) When prompted, enter the full path of the .wav file you want to play when you lock the computer. (see screenshot below)
F) When prompted, enter the password for the account to authorize the task.
G) When finished, press any key to close the command prompt.
1 Press the Win + R keys to open Run, type taskschd.msc into Run, and click/tap on OK to open Task Scheduler.
2 Click/tap on Task Scheduler Library in the left pane of Task Scheduler, and click/tap on Create Task in the right Actions pane. (see screenshot below)
3 In the General tab, type a name (ex: "Play lock sound") you want for this task. (see screenshot below)
4 In the General tab, select (dot) Run whether user is logged on or not. (see screenshot below)
5 In the General tab, check the Run with highest privileges box. (see screenshot below)
6 In the General tab, select your OS (ex: "Windows 10") in the Configure for drop down. (see screenshot below)
7 Click/tap on the Triggers tab, and click/tap on the New button. (see screenshot below)
8 Select On workstation lock in the Begin the task drop down, and click/tap on OK. (see screenshot below)
9 Click/tap on the Actions tab, and click/tap on the New button. (see screenshot below)
10 Perform the actions below: (see screenshot below)
A) Select Start a program in the Action drop down.
B) TypePowerShell
in the Program/script field box.
C) Enter the command below into the Add arguments field box, and click/tap on OK.
-c (New-Object Media.SoundPlayer 'C:\Windows\Media\Windows Unlock.wav').PlaySync();
If you wanted to play a sound (.wav file) of your choice instead, you can substitute C:\Windows\Media\Windows Unlock.wav in the command above with the full path of the .wav file you want to be played.
The Windows Unlock.wav file is not available in Windows 7, but you can download it below if you like.
Download
11 Click/tap on the Conditions tab, uncheck the Start the task only if the computer is on AC power box, and click/tap on OK. (see screenshot below)
12 Enter your account's password, and click/tap on OK. (see screenshot below)
13 This task (ex: "Play lock sound") is now finished, and will now play a sound when users lock the computer. (see screenshot below)
That's it,
Shawn
Related Tutorials
- How to Change your Event Sounds in Windows 10
- How to Play Sound at Logoff (Sign-out) in Windows 10
- How to Play Sound at Logon (Sign-in) in Windows 10
- How to Play Sound at Shutdown in Windows 10
- How to Turn On or Off Play Windows Startup Sound in Windows 10
- How to Change Windows Startup Sound in Windows 10
- How to Play Sound when Unlock Computer in Windows
- How to Lock the Computer in Windows 10
- How to Enable or Disable Lock Computer in Windows
- How to Enable or Disable Secure Sign-in with Ctrl+Alt+Delete in Windows 10
- How to Automatically Lock Computer in Windows 10
- How to Automatically Lock Windows 10 PC with your Phone
- How to Remove Lock Computer from Ctrl+Alt+Del Screen in Windows