Disable/Filter Microphone(s) in Windows 7 VDI via Registry

Registry Permissions for user


This has to done in a offline mode, for XenDesktop with PVS; mount the VHD file from Disk Management and set the permissions.

Disable Microphone(s)




Script to Disable all non Standard Microphone (Allow only Plantronics/HDX headsets)

$audioCaptureRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" 
$systemNameVal = "{b3f8fa53-0004-438e-9003-51a46e139bfc},6"
$MICS = Get-Item $audioCaptureRegPath
$MICS.GetSubKeyNames() | % {`
    if($(Get-ItemProperty -Path $audioCaptureRegPath"\"$_).DeviceState -eq 1 ){`
    $systemNameData=$(Get-ItemProperty -Path $audioCaptureRegPath"\"$_\Properties).$systemNameVal
    if(!($systemNameData -match "plant") -or !($systemNameData -match "HDX"))
    #The below throws access denied errors
    #Set-ItemProperty $audioCaptureRegPath"\"$_ -Name "DeviceState"  -Value "4"
    $tmpFileFullPath = [System.io.Path]::getTempFileName()
    "Windows Registry Editor Version 5.00" | Out-File -FilePath  $tmpFileFullPath -Append
    " " | Out-File -FilePath  $tmpFileFullPath -Append
    "[$($MICS.Name)\$_]" | Out-File -FilePath  $tmpFileFullPath -Append
    #10000001 disables but makes it visible in GUI | 00000004 disables and prevents 
    #it from being visible in Recording Devices GUI
    "`"DeviceState`"=dword:10000001" | Out-File -FilePath  $tmpFileFullPath -Append
    " " | Out-File -FilePath  $tmpFileFullPath -Append
    regedit.exe /S $tmpFileFullPath

Download Script


7 thoughts on “Disable/Filter Microphone(s) in Windows 7 VDI via Registry

  1. Each GUID will be different. How do you generalize it, to figure out each systems Audio GUID ? I need to script out for a VM to automatically set the microphone of that VM (Desktop) to be default.

  2. Kyle,

    that can be achieved by enumerating the following reg for MIC and Speakers respectively



    from the script above $systemNameVal holds the PKEY_Device_FriendlyName which is the audio device friendly name that is seen from the windows audio GUI.

    I go through each guid and disable the devices that do not match the friendly name i need using DeviceState reg value. this will automatically make the preferred device to be the only default.

    DeviceState=0x10000004 hides it from the gui
    DeviceState=0x00000004 sets as disabled.
    DeviceState=0x00000001 sets as available

    Since my script only makes one device as available, that devices will automatically become default.

    Note: Plantronics is the audio device friendly name I used to demonstrate in the post.

    Hope this makes it clear.


  3. Siva-

    Thanks for your reply. I tried to download your script, but the archive was corrupt. Can I get a copy still ?



  4. Just wanted to point out that I couldn’t get it to work initially but after I fiddled around with it I noticed that there was a typo in the script.

    “[$($MIC.Name)\$_]” | Out-File -FilePath $tmpFileFullPath -Append

    should be

    “[$($MICS.Name)\$_]” | Out-File -FilePath $tmpFileFullPath -Append

    After changing to that the script worked.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s