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.
4 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-ChildItemgets all app events.Get-ChildItemgets 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.
- 346
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"
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
}
- 4,816
If, as you said, you making a fresh windows installation script, the schemes of the sounds can also adjusted through the selected Windows visual theme. So, we can edit eg the default theme (or any other saved theme) from the C:\Windows\Resources\Themes\<aero>.theme .
Open the <Name>.theme file with a notepad and edit the part under [Sounds] : SchemeName=
eg. SchemeName=<Saved_sound_scheme_name>
(after equal sign, leave it empty to have no sound)
The same way we can edit user's saved Themes.
The user's Themes are saved here:
C:\Users\<User_Name>\AppData\Local\Microsoft\Windows\Themes \<Saved>.theme
-------- %UserProfile%\AppData\Local\Microsoft\Windows\Themes \<Saved>.theme
Note that we can drop a .theme file there, or just double click it from anywhere, and it will appear in Settings ->Themes as activated.
As the question mentions about to change sounds, we can also add parts in the same .theme file as the following example. (they're not all, but just an example to follow the idea)
Parts of <Saved>.theme file:
[Sounds]
; IDS_SCHEME_DEFAULT
SchemeName=MySounds
[AppEvents\Schemes\Apps.Default.Default]
DefaultValue=%SystemRoot%\Media\Windows Ringout.wav
[AppEvents\Schemes\Apps.Default\AppGPFault]
DefaultValue=%SystemRoot%\media\Windows Battery Low.wav
[AppEvents\Schemes\Apps.Default\CriticalBatteryAlarm]
DefaultValue=
[AppEvents\Schemes\Apps.Default\LowBatteryAlarm]
DefaultValue=
[AppEvents\Schemes\Apps.Default\SystemQuestion]
DefaultValue=%SystemRoot%\media\Windows Notify.wav
[AppEvents\Schemes\Apps\Explorer\MoveMenuItem]
DefaultValue=%SystemRoot%\media\ding.wav
[AppEvents\Schemes\Apps\Explorer\Navigating]
DefaultValue=
After edits, we can store a copy of the <Saved>.theme file and push it to any Windows PC.
The Default Windows sound files (.wav) are here:
C:\Windows\media\...
The Windows Themes in Registry can found here:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes
- 53