Change sound scheme in windows via register

3

How can I change sound scheme to "no sound" for existing user by editing registry? I'm making a .reg file with all tweaks I need on freshly installed windows but I'm stuck with changing sound scheme.

Bearded Beaver

Posted 2018-03-05T09:08:06.683

Reputation: 133

Answers

8

Changing the scheme is relatively easy. However, you then have to apply the new scheme, which is a bit more involved.

The "No Sounds" scheme has the name .None; you can see this by exploring HKEY_CURRENT_USER\AppEvents\Schemes\Names.

The selected scheme is at HKEY_CURRENT_USER\AppEvents\Schemes, which defaults to .Default. So you can set the selected scheme by changing this to .None:

New-ItemProperty -Path HKCU:\AppEvents\Schemes -Name "(Default)" -Value ".None" -Force | Out-Null

This will (technically) set the selected scheme, which you can verify by going to your Sounds settings and see that the No Sounds scheme is selected. However, the event sounds will still play, and that is because the selected scheme has not been applied.

To apply a sounds scheme, the appropriate action is:

  • For each app event matching HKEY_CURRENT_USER\AppEvents\Schemes\Apps\*\*, copy the subkey for the new scheme name over the subkey called .Current.

As an example, to apply the No Sounds scheme to the System Exclamation event, you would copy HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemExclamation\.None over HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemExclamation\.Current.

However, in your case, you can just clear out all the values, since you're applying a "no sounds" theme. This can be accomplished by an one-liner:

Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps" | Get-ChildItem | Get-ChildItem | Where-Object {$_.PSChildName -eq ".Current"} | Set-ItemProperty -Name "(Default)" -Value ""

Step by step:

  • Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps" gets all apps.
  • Get-ChildItem gets all app events.
  • Get-ChildItem gets all app event sound settings for each scheme.
  • Where-Object {$_.PSChildName -eq ".Current"} selects all the app event sound settings that are currently applied.
  • Set-ItemProperty -Name "(Default)" -Value "" clears those sound settings.

For a bit more detail:

It appears that the keys under HKEY_CURRENT_USER\AppEvents\Schemes\Apps are the apps, with their default value being a display string. The ones on my system are .Default ("Windows"), Explorer ("File Explorer"), and sapisvr ("Speech Recognition").

The keys under each app key are the app events for that app.

The keys under each app event key are the sounds to play for each sound scheme. So HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemExclamation\.None is the sound to play for Windows' System Exclamation when using the No Sounds scheme, and HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemExclamation\.Default is the sound to play for Windows' System Exclamation when using the Windows Default scheme.

In addition, there's a .Current key at this level that is the actual sound that is played. Presumably, when you select a new scheme in the UI, it copies each of the settings individually over the .Current value.

Stephen Cleary

Posted 2018-03-05T09:08:06.683

Reputation: 196

Thank you for such detailed answer, I will try this solution a bit later – Bearded Beaver – 2019-01-24T18:08:46.670

You could shorten the two stacked gci's and the where to => Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps\*\*\.current" as Get-ChildItem allows wildcards on multiple levels. – LotPings – 2019-06-16T15:16:57.040

0

I just created this script. Use at your own risk;

if (-Not (Test-Path 'HKCU:\AppEvents\Schemes\Names\.None'))
{ 
    New-Item -Path 'HKCU:\AppEvents\Schemes\Names' -Name '.None'
    New-ItemProperty -Path 'HKCU:\AppEvents\Schemes\Names\.None' -Name '(Default)' -Type 'String' -Value 'No Sounds'
}

Get-ChildItem -Path 'HKCU:\AppEvents\Schemes\Apps\.Default' | Select Name | ForEach-Object {
    $thing = $_.Name -replace "HKEY_CURRENT_USER", "HKCU:"
    $fullnun = "$thing\.None"
    if (-Not (Test-Path $thing))
    {
        New-Item -Path $thing -Name '.None'
        echo "$thing\.None created"
    } else {
        echo "$thing\.None already existed"
    }

    if (Test-Path($fullnun))
    {
        New-ItemProperty -Path $fullnun -Name '(Default)' -Type 'String' -Value ''
    }
}

Set-ItemProperty -Path 'hkcu:\AppEvents\Schemes' -Name "(Default)" -Type "String" -Value ".None"

Jacob Brown

Posted 2018-03-05T09:08:06.683

Reputation: 1

Unfortunately, this did not work for me on Windows 10 build 14393 – jippyjoe4 – 2018-06-10T02:13:28.013

0

Here is my code for setting Sound Schemes to 'NO SOUND'

Write-Host " Setting Sound Schemes to 'No Sound' .." -foregroundcolor Gray -backgroundcolor black

$Path = "HKCU:\AppEvents\Schemes"

$Keyname = "(Default)"

$SetValue = ".None"

$TestPath = Test-Path $Path
if (-Not($TestPath -eq $True)) {
   Write-Host " Creating Folder.. " -foregroundcolor Gray -backgroundcolor black
   New-item $path -force
}

if (Get-ItemProperty -path $Path -name $KeyName -EA SilentlyContinue) {

   $Keyvalue = (Get-ItemProperty -path $Path).$keyname

   if ($KeyValue -eq $setValue) {

       Write-Host " The Registry Key Already Exists. " -foregroundcolor green -backgroundcolor black


   }
   else {

       Write-Host " Changing Key Value.. " -foregroundcolor Gray -backgroundcolor black

       New-itemProperty -path $Path -Name $keyname -value $SetValue -force # Set 'No Sound' Schemes
       Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps" | # Apply 'No Sound' Schemes
        Get-ChildItem |
        Get-ChildItem |
        Where-Object { $_.PSChildName -eq ".Current" } |
        Set-ItemProperty -Name "(Default)" -Value ""

       Write-Host " The Registry Key Value Changed Sucessfully. " -foregroundcolor green -backgroundcolor black
   }

}
else {

   Write-Host " Creating Registry Key.. " -foregroundcolor Gray -backgroundcolor black

   New-itemProperty -path $Path -Name $keyname -value $SetValue -force
   Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps" |
       Get-ChildItem |
       Get-ChildItem |
       Where-Object { $_.PSChildName -eq ".Current" } |
       Set-ItemProperty -Name "(Default)" -Value ""


   Write-Host " The Registry Key Created Sucessfully. " -foregroundcolor green -backgroundcolor black
}

Ankur Shrivastava

Posted 2018-03-05T09:08:06.683

Reputation: 1

This looks somewhat similar to Jacob Brown’s answer.  How is it different?  (Is it better?)  Please do not respond in comments; [edit] your answer to make it clearer and more complete.

– Scott – 2019-06-25T15:43:41.197