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.


The sample scripts provided below are adapted from third-party open-source sites.

Script to set the master volume

The following script installs a NuGet package with a minimum version of without any user interaction.
Then the above script installs the AudioDeviceCmdlets module which consists of basic command lines of audio device controls with the help of NuGet package manager using PowerShell. It uses the playbackvolume parameter 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.)

Running this script will automatically adjust the device’s sound to the configured master volume. The user will still be able to change the volume level or disable sound from the device end.

To confirm whether the script has worked, you can check the Action History tab of the corresponding devices.

View output of script to modify audio levels under Action History tab


  • The minimum and maximum allowed range of the playbackvolume parameter is 0 and 100 respectively. If any value other than the allowed range is specified, then errors such as “Cannot validate argument on parameter ‘PlaybackVolume’. Supply an argument that is in the allowed range of 0 to 100 and then try the command again,” may appear in the Action History tab as an output, and the device’s master volume might not be changed.
  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository