I am trying to disable the microphone from cmd or c#. enter image description here

I tried to use devcon.exe, but it disables the device in Device Manager but not in the sound properties.

I tried to write to the registry:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{6f512f63-a7a0-4f4f-b24c-73dd352b6709}" /v DeviceState /d 0x10000001 /t Reg_DWord /f

Even in the elevated mode in cmd I get the error:

ERROR: Access is denied.

I read it is because the registry is protected and I would have to take the ownership of the registry before applying that change.

When I use .reg file:

Windows Registry Editor Version 5.00


Everything seems to be fine, no error is displayed, but the registry is not changed.

I also tried to run the above commands from the Windows Service (Local System), but with no success.

What are the other ways I can try to disable playback/recording devices programmatically?

I modified the reg file a bit. I used Procmon.exe to check what is changed when I click 'Disable' and now reg file looks like this:

Windows Registry Editor Version 5.00



When I applied this .reg file as a user (by clicking on the file), the recording device gets disabled correctly. I have two questions now:
1. It seems to be a very messy solution, is it safe to use this reg file?
2. I cannot apply this reg file using Windows Service, I am guessing, these registries are blocked by the User account or something, right?

  • Does this answer your question? Shortcut to enable/disable a device in Windows
    – CaldeiraG
    Dec 18, 2019 at 13:41
  • 1
    Unfortunately not. As I wrote in the question, devcon.exe allows to disable/enable devices in Device Manager - this is something different than disable/enable in sound properties.
    – Chris
    Dec 18, 2019 at 14:05
  • Right, I missed that part, sorry about that.
    – CaldeiraG
    Dec 18, 2019 at 14:16


You must log in to answer this question.

Browse other questions tagged .