To follow these steps, you must sign in as an administrator. Also, if you want to play custom audio, you need to convert your regular .mp3 file to .wav format.
Play a sound when you Shutdown, Lock or Unlock PC
To play a sound when you Shutdown, Lock or Unlock Windows 10, follow these steps- Open Task Scheduler on your Windows 10 computer. To do so, you can search for “task scheduler” in the Taskbar search box, and click on the result. Now, you need to select Task Scheduler Library on the left side and click on the Create Task button on your right side.
In the General tab, do write the name of your task in the Name box, select Run whether user is logged on or not, and select in the Run with highest privileges checkbox. After that, expand the Configure for drop-down list, and select Windows 10.
Then, you need to switch to the Triggers tab and click the New button. In the New Trigger window, select On an event from Begin the task drop-down list, System from the Log drop-down list, and enter 1074 as the Event ID. 1074 represents user-initiated shutdown.
After clicking the OK button, you need to visit the Actions tab and click the New button. In the New Action window, select Start a program from Action drop-down list, write PowerShell in the Program/Script box, and enter the following argument in the Add arguments box- C:\Windows\Media\Windows Shutdown.wav is the default shutdown sound. If you want to use custom audio, you need to place the audio file in the C:\Windows\Media\ folder and select the path in the argument.
After clicking the OK button, you need to go to the Conditions tab. From here, you need to uncheck Start the task only if the computer is on AC power and click the OK button.
Now you should see a prompt where you have to enter the user account password. If you do that successfully, a new task would be created and you Windows 10 system would play a sound when shutting down the PC. If you want to play a sound when Lock or Unlock computer, you can follow these same steps. However, there is only one thing that is different. You need to select On workstation lock or On workstation unlock in the New Trigger window. That’s all!