gpt4 book ai didi

powershell - 如何通过powershell将sound Scheme设置为 "No Sound"?

转载 作者:行者123 更新时间:2023-12-05 05:10:28 26 4
gpt4 key购买 nike

我们在我们的网络中使用了大约 300 多台 Windows10 电脑,我们必须将声音方案从“Windows 默认”设置为“无声音”,Powershell 可以吗?

最佳答案

我在这里找到

# Set Sound Schemes to no sound


Write-Host "`nSetting Sound Schemes to 'No Sound' .." -foregroundcolor Gray

$Path = "HKCU:\AppEvents\Schemes"

$Keyname = "(Default)"

$SetValue = ".None"

$TestPath = Test-Path $Path
if (-Not($TestPath -eq $True)) {
Write-Host " Creating Folder.. " -foregroundcolor Gray
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


}
else {

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

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
}

}
else {

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

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
}

关于powershell - 如何通过powershell将sound Scheme设置为 "No Sound"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56619933/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com