Category filter
Script to adjust master volume on Windows devices
When used in public spaces like kiosks or shared workstations, it is required to set predefined audio levels for devices. IT admins may need to adjust the device volume to an optimum level, for instance, in smart classrooms and conference room digital signage installations. On Windows PCs, the user should modify the master volume to change all sounds. The volume for individual apps and system sounds can then be configured as a percentage of the master volume.
Admins can use the PowerShell script provided below to remotely modify the master volume on Windows devices with the help of Hexnode’s Execute Custom Script action.
Script to set the master volume
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$preferredVolume = 42 try{ if(-not( Get-PackageProvider | Where-Object {$_.Name -eq "Nuget"})) { #installing nuget package if doesn't exists. Install-packageprovider -name Nuget -MinimumVersion 2.8.5.201 -Force } if (-not(Get-Module -ListAvailable | Where-Object {$_.Name -eq "AudioDeviceCmdlets"})) { #installing audiodevicecmdlets module Install-Module -name AudioDeviceCmdlets -Force } Set-AudioDevice -playbackvolume $preferredVolume Write-Host "Successfully configured", $preferredVolume } catch{ Write-Host $_.exception.message } |
The script given above installs the AudioDeviceCmdlets module and uses it to set the device’s master volume to the desired value. Set the variable $preferredVolume to the necessary volume level. (Replace 42 with the required volume.)
To confirm whether the script has worked, you can check the Action History tab of the corresponding devices.