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.
3 Answers
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.
-
2You could shorten the two stacked gci's and the where to =>
Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps\*\*\.current"
asGet-ChildItem
allows wildcards on multiple levels.– LotPingsJun 16, 2019 at 15:16
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"
-
Unfortunately, this did not work for me on Windows 10 build 14393 Jun 10, 2018 at 2:13
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
}