VMware Horizon Community
serinfbco
Enthusiast
Enthusiast

Vmware Blast - Script to change microphone audio quality to 16khz/48hz - Workaround

Hello,

 

I'm been searching a way to set back the 16khz audio quality on Vmware Blast / Devtap driver.

This KB tells that the driver sets back to 8khz, which is bad audio quality for video conference such as teams or zoom meetings : VMware Knowledge Base

 

I used Regshot to pinpoint where it stores the settings about 16khz and it is in the keys  @ HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture

To make this difficult, the GUIDs are not the same, so you have to search the subkeys to know if it's the Blast driver such as " XXX (VDI)" or "Vmware Audio ...."

 

Test it before production env. It touches the registry deeply, use at your own risk.

Tested on Windows 10 Education 20H2 64-bit, Vmware Horizon View 7.13 and View 8.4

 

Updated version to support 48000hz with Horizon View 8.3+

 

For better stability, we started using SoundViewVolume from nircmd. Thank you ECBCBSMA!

View / change sound volume on Windows from command line or GUI (nirsoft.net)

This script can be used on user login / GPO

 

 

 

 

 

Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture"
Set objShell = WScript.CreateObject ("WScript.shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

wscript.sleep(10000)

'WScript.Echo key
oreg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
objFSO.CopyFile "\\networkdrive\SoundVolumeView.exe","C:\folder\SoundVolumeView.exe"
If Not IsNull(arrSubKeys) Then
    For Each subkey In arrSubKeys
        'WScript.Echo subkey
        subkeypath = strKeyPath  & "\" & subkey & "\Properties"
        oReg.GetStringValue HKEY_LOCAL_MACHINE, subkeypath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},6", strValue

        
    	'wscript.echo strValue
        if instr(strValue, "VDI") > 0 OR instr(strValue,"VMware") > 0 then
            If objFSO.GetFileVersion("C:\Program Files\VMware\VMware View\Agent\bin\wsnm.exe") >= "8.3.0.0" then
                objShell.Run """C:\folder\SoundVolumeView.exe"" /SetDefaultFormat """& strValue &""" 16 48000 1",0,true
            else
                objShell.Run """C:\folder\SoundVolumeView.exe"" /SetDefaultFormat """& strValue &""" 16 16000 1",0,true
            end if
        end if

    Next
End if

 

 

 

 

 

 

 

 

Old version by writing the registries 

 

Strangely, this is secured by Microsoft as SYSTEM account has no rights, also you get denied access from powershell script and reg.exe (even UAC elevated)

You need to use credentials as an administrator/UAC with regedit.exe /s ... so the script writes back the values with the modified parts.

You have to create a scheduled task on logon that calls this script. Didn't test GPO way.

 

 

 

 

Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture"
Set objShell = WScript.CreateObject ("WScript.shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1, ForWriting = 2, ForAppending = 8

wscript.sleep(10000)

strLogFolder = "C:\folder"
Set objLogFile = objFSO.OpenTextFile( strLogFolder & "\audio.reg", ForWriting, True)
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

objLogFile.WriteLine "Windows Registry Editor Version 5.00"

'WScript.Echo key
oreg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
If Not IsNull(arrSubKeys) Then
    For Each subkey In arrSubKeys
        'WScript.Echo subkey
        subkeypath = strKeyPath  & "\" & subkey & "\Properties"
        oReg.GetStringValue HKEY_LOCAL_MACHINE, subkeypath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},6", strValue
    	'wscript.echo strValue
        if instr(strValue, "VDI") > 0 OR instr(strValue,"VMware") > 0 then
            objLogFile.WriteLine "[HKEY_LOCAL_MACHINE\" & subkeypath & "]"
            
                'View 8.3+ - 48khz'
                If objFSO.GetFileVersion("C:\Program Files\VMware\VMware View\Agent\bin\wsnm.exe") >= "8.3.0.0" then
                  objLogFile.WriteLine """{f19f064d-082c-4e27-bc73-6882a1bb8e4c},0""=hex:41,00,64,00,01,00,00,00,fe,ff,01,00,80,bb,00,00,00,77,01,00,02,00,10,00,16,00,10,00,04,00,00,00,01,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
                  objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},3""=hex:41,00,01,00,01,00,00,00,fe,ff,01,00,80,bb,00,00,00,ee,02,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
                  objLogFile.WriteLine """{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0""=hex:41,00,64,00,01,00,00,00,fe,ff,01,00,80,bb,00,00,00,ee,02,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
                  objLogFile.WriteLine """{624f56de-fd24-473e-814a-de40aacaed16},3""=hex:41,00,64,00,01,00,00,00,fe,ff,01,00,80,bb,00,00,00,ee,02,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
                  objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},5""=hex:41,00,6f,0a,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
                  objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},5""=hex:41,00,69,0a,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
                  objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},9""=hex:41,00,00,00,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
                  objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},9""=hex:41,00,69,0a,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
                  objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},10""=hex:41,00,69,0a,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
                  objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},10""=hex:41,00,69,0a,01,00,00,00,03,00,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,00,00"
            else      
               objLogFile.WriteLine """{f19f064d-082c-4e27-bc73-6882a1bb8e4c},0""=hex:41,00,31,00,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,7d,00,00,02,00,10,00,16,00,10,00,04,00,00,00,01,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},3""=hex:41,00,01,00,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0""=hex:41,00,ca,36,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{624f56de-fd24-473e-814a-de40aacaed16},3""=hex:41,00,01,00,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},5""=hex:41,00,01,00,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},9""=hex:41,00,ca,36,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{3d6e1656-2e50-4c4c-8d85-d0acae3c6c68},10""=hex:41,00,31,00,01,00,00,00,fe,ff,01,00,80,3e,00,00,00,fa,00,00,04,00,20,00,16,00,20,00,04,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71"
               objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},5""=-"
               objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},9""=-"
               objLogFile.WriteLine """{33b83365-ab41-4b3b-8f32-ab8d96168070},10""=-"
            end if

        end if

    Next
    objLogFile.close
    objShell.run "cmd /c regedit.exe /S "& strLogFolder &"\audio.reg",0,true
End if

 

 

 

 

 

 

 

 

3 Replies
MaxStr
Hot Shot
Hot Shot

Ouch... I didn't even know it lowered the quality like that. This looks like something VMWare should add as a GPO or client option

Steffen14
Contributor
Contributor

 if instr(strValue, "VDI") > 0 OR instr(strValue,"Vmware") > 0 then

there is a typo.

we need your wonderful script but it didnt work. we have inhouse developers here and  they checked your script cause i was unable to get it running.

 

if you correct your String to 

 if instr(strValue, "VDI") > 0 OR instr(strValue,"VMware") > 0 then

(Uppercase for the M in VMware)

 

the it running fine 🙂

Reply
0 Kudos
jobrienmagna
Contributor
Contributor

Hi Everyone,

 

Hoping for a bit of clarification here.

Is this to be run via cmd line as a .bat?

Does it have any other requirements?

I am getting 'is not recognized as an internal or external command"



 

====================================================

C:\temp>choppyaudio.bat

C:\temp>Const HKEY_LOCAL_MACHINE = & H80000002
'Const' is not recognized as an internal or external command,
operable program or batch file.
'H80000002' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture"
'strKeyPath' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>Set objShell = WScript.CreateObject ("WScript.shell")

C:\temp>Set objFSO = CreateObject("Scripting.FileSystemObject")

C:\temp>Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

C:\temp>wscript.sleep(10000)
'wscript.sleep' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>objFSO.CopyFile "\\volshare\SoundVolumeView\SoundVolumeView.exe","C:\SoundVolumeView\SoundVolumeView.exe"
'objFSO.CopyFile' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>'WScript.Echo key
''WScript.Echo' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>oreg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
'oreg.EnumKey' is not recognized as an internal or external command,
operable program or batch file.
Then was unexpected at this time.

C:\temp>If Not IsNull(arrSubKeys) Then

 

Reply
0 Kudos