I'm attempting to shut down the microphone and camera on Windows 10. I'm trying to automate this process after loading the OS. I attempt to use Disable-PnpDevice in powershell but that does nothing. Unfortunately I am not at liberty to use Devcon. I thought maybe I'd write a .reg file where I basically just set the value for the audio endpoint and camera to "Deny" but I really have no idea how to do this. Can someone point me in the right direction? Thanks a lot.

  • Do you mean to disable them completely? – Jamie Hanrahan Jul 27 '18 at 0:59
  • When you say "automate", it isn't clear whether you need to do a one-time shut-off on a large number of machines, or create a simple ability to shut-off as needed (repetitive) on your own machine. Can you clarify? Also, I would think that once Windows is loaded, it's too late to affect that session by changing the registry., so what you're trying to do isn't clear. – fixer1234 Jul 27 '18 at 5:11
  • Yes one-time shut off. Registry is the answer I believe. – Psyllex Jul 27 '18 at 18:14

Use MS SysInternals procmon, and run while making change to the settings using the Windows UI. Search the output for the regekys / strings that were changed and used that in you script for other target systems as needed.

Secondly, if this is your personal machine, why not get and use devcon, if it an enterprise environment, OK, I've seen where it is not allowed.

  • Yes about an hour after I aksed this question that's similar to what I did. I search the registry for the microphone. Found it, disabled it. Then exported the reg file. Now I just have to throw it into my ansible script and I should be alright provided I can find a way to get around the "Confirmation" prompts. (and yes this is for enterprise so Devcon isn't an option) – Psyllex Jul 27 '18 at 18:14
  • Is the ConfirmPreferences not working for you? Meaning '-Confirm:$false' – postanote Jul 27 '18 at 19:23
  • I haven't actually gave the ansible script a shot yet. But yes, that was my intent to use Confirm: $false. I don't know if it works on double confirmations which I believe registry settings require, but don't quote me on that. – Psyllex Jul 28 '18 at 17:39
  • Understood. I hate to suggest the SendKeys approach, but that too may be an option dealing with multiple confirmations. The issue with sendkeys, it that timing those keystroke sends can be a challenge from machine to machine. Well, that and the work needed to capture the right window/dialog to hit. – postanote Jul 30 '18 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.