I'm trying to write a script that let's me check whether the Webcam and Microphone are in use. For the webcam I already managed to write something in Python, however so far I haven't found a good way to do the same for the microphone.
In Windows you have a dedicated setting in the SysTray that is showing up when your microphone is actually used by an app (and even showing which one):
So obviously Windows knows whether it's used at the moment (that's all I would need) and even which application is using it. However I did not find any way to read that information out in any way yet.
Is it possible to somehow get the data from Windows itself? At this point, I don't even mind which language would be used for it, Python, C#, PowerShell or whatever.
PS: I know there might be ways to access the microphone wihtout it being shown in the SysTray, but this case is not relevant for what I'm trying to achieve.
you can check this registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone
Under the NonPackaged key, all non-microsoft applications that have used the microphone are listed with path to the executable. If an application is currently using the mic, the LastUsedTimeStop value is set to 0. Cheers!