Windows 10 Enable Logon, Logoff and Shutdown Sound Scheme In Windows 10

CarlosPR

New Member
Joined
Jul 28, 2021
Messages
1
Hi I want to make the system sound when ever I Logon, Logoff or Shutdown my PC.
I already went through the process (regedit) of enabling the option in the sound scheme but any sound I put in there doesn't sound.
There are work around that I found that use .vbs and PowerShell Commands using Task Scheduler, but it's not the ones I Want.
I want to play the sound I have chosen under the sound scheme settings not open a file from (C:\Windows\Media\file.wav) because I use themes and when I change the theme the sounds doesn't change cause its opening a file and is not going through the sound scheme.
If there is any PowerShell command that play the Logon, Logoff and Shutdown from the sound scheme settings section I will appreciate it.
The picture I uploaded will show you what Sound Scheme Settings I'm Referring too.
Thank You for your cooperation
 


Attachments

  • Sound Sheme Settings.webp
    Sound Sheme Settings.webp
    24.2 KB · Views: 99
Solution
To play system sounds such as Logon, Logoff, and Shutdown from the sound scheme settings using PowerShell, you can utilize the Windows API functions. Here's a PowerShell script that can help you achieve this directly without relying on specific files:
Code:
Add-Type -TypeDefinition @" using System.Runtime.InteropServices; public static class SystemSounds { [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MessageBeep(uint uType); } "@ # Define the sound type constants $MB_ICONHAND = 0x10 $MB_ICONASTERISK = 0x40 $MB_ICONEXCLAMATION = 0x30 # Play the Logon sound [SystemSounds]::MessageBeep($MB_ICONHAND) # Add a delay if needed # Start-Sleep -Seconds 2 # Play the...
To play system sounds such as Logon, Logoff, and Shutdown from the sound scheme settings using PowerShell, you can utilize the Windows API functions. Here's a PowerShell script that can help you achieve this directly without relying on specific files:
Code:
Add-Type -TypeDefinition @" using System.Runtime.InteropServices; public static class SystemSounds { [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MessageBeep(uint uType); } "@ # Define the sound type constants $MB_ICONHAND = 0x10 $MB_ICONASTERISK = 0x40 $MB_ICONEXCLAMATION = 0x30 # Play the Logon sound [SystemSounds]::MessageBeep($MB_ICONHAND) # Add a delay if needed # Start-Sleep -Seconds 2 # Play the Logoff sound [SystemSounds]::MessageBeep($MB_ICONEXCLAMATION) # Add a delay if needed # Start-Sleep -Seconds 2 # Play the Shutdown sound [SystemSounds]::MessageBeep($MB_ICONASTERISK)
This script uses the MessageBeep function from the user32.dll to play system sounds similar to those defined within the sound scheme settings. You can run this PowerShell script to play the system sounds specified in the sound scheme settings for Logon, Logoff, and Shutdown. Make sure to save the script with a .ps1 extension and run it as an administrator. This approach directly triggers system sounds based on system events rather than playing specific sound files, ensuring that the sounds adhere to the configured sound scheme settings.
 


Solution
Back
Top