Hearing Windows startup and other sounds from Windows events is just fine, but it can get quite annoying if someone has set their computers’ sound volume at a 100%. This is especially true at big offices or classrooms with many people and computers. Because turning off the soundcard in computers in not always an option, this article will explain how you can control the volume level on computers with programmatically using a vbscript and an ActiveX object. Included are the ActiveX file, a sample vbscript and a Windows Installer msi file for deployment purposes.
Set The Sound Level
To set the volume level of the microphone and volume levels we will use an ActiveX object loosly based on a Microsoft sample download. Using a vbscript logonscript you’re able to manipulate the volume level programmatically.
Get Started
Setting the soundlevel is easy. From the download section, download the SetSoundLevel zip file. This file contains the SetSoundLevel ActiveX file, a sample vbscript and a Windows Installer msi package for installing the control using group policy or System Management Server.
Manual Installation
First you have to download the SetSoundLevel zip file. To perform a manual installation, copy the SetSoundLevel.dll control to your computer. To the %ProgramFiles%\SetSoundLevel folder for example. Then run the following command:
Regsvr32 “%ProgramFiles%\SetSoundLevel\SetSoundLevel.dll”

The regsvr32.exe command should return a message saying the installation succeeded.
Automatic Installation
The Windows installer file, SetSoundLevel.msi, is included in the download and does the same thing.

Open it and click Next, Next, Finish and you’re done.
Note: You have to be local administrator to do perform these actions.
Automatic installation can be achieved by using System Management Server or Intellimirror group policy and assign it to the Computer Configuration --> Software Installation (Publishing the .msi to users will not work).
Testing
After the control is installed on your machine, you can use the included vbscript, setsoundlevel.vbs, to test setting the sound volume level.
Sub SetSoundLevel ( iMyLevel )
On Error Resume Next
Err.Clear
Dim blSoundDevicePresent
Dim objSoundDevice
blSoundDevicePresent = False
For Each objSoundDevice In GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("Win32_SoundDevice")
blSoundDevicePresent = True
Exit For
Next
If Not blSoundDevicePresent Then Exit Sub
Dim iDefaultLevel, iSoundLevel, objSoundLevel
iDefaultLevel = 5
If Not IsNumeric ( iMyLevel ) Then iMyLevel = iDefaultLevel
MyLevel = CInt ( iMyLevel )
If Err.number <> 0 Then iMyLevel = iDefaultLevel
If iMyLevel < 0 Or iMyLevel > 100 Then iMyLevel = iDefaultLevel
Err.Clear
set objSoundLevel = CreateObject ( "SetSoundLevel.SoundLevel" )
If Err.number <> 0 Then Exit Sub
iSoundLevel = iMyLevel * ( objSoundLevel.GetMaxSoundLevel - objSoundLevel.GetMinSoundLevel ) / 100
objSoundLevel.SetSoundLevel iSoundLevel
set objSoundLevel = Nothing
End Sub
Note: For security reasons, the script is named setsoundlevel.vbs.txt. Remove the .txt extension before you try to run this script.
If you open the script, you will find a subroutine named SetSoundLevel. It will take an integer value between 0 and 100 to set the sound volume level. By default the script will set the level to 10(%).
You can easily incorporate this subroutine in your existing logon vbscript or run it as a separate logon script.
Note: Just be sure you remove the msgbox "Finished" statement from the script
More Information:
178456 SAMPLE: Volume.exe: Set Volume Control Levels Using Visual Basic (Volume.exe)
Let me know how it worked out for you and add a comment!