So this took much longer to look into than i thought
Initially I thought something like this should work:
Get-PnpDevice -FriendlyName '*Stereo Mix*' | Enable-PnpDevice -Confirm:$false
but no dice… maybe it would work for you. I can’t seem to get it to work (with or without admin rights) when the device is in a ‘disabled’ state. I just get a generic error. I fought with for a bit and gave up.
One other way i thought about was a reg key. One can use something like ‘regmon’ to monitor… but I figured someone probably did this before from a general device perspective. I did some digging and it seems the device ID lines up with the keys in this reg path:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\
The output of Get-PNPDevice
gives some identifying info, namely DeviceID:
Get-PnpDevice -FriendlyName '*Stereo Mix*' | Select-Object -ExpandProperty DeviceID
For me this outputs:
SWD\MMDEVAPI\{0.0.1.00000000}.{A9B18BD2-0466-4251-AC78-FC1B6D4E9353}
The {A9B18BD2-0466-4251-AC78-FC1B6D4E9353
appears to be the GUID and also happens to be a subkey of the reg path above… so:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{a9b18bd2-0466-4251-ac78-fc1b6d4e9353}
In this Key, noticed there was a DeviceState DWORD value. Toying it with that key some. I found that a value of ‘1’ seems to be enabled (though if you set it in registry, the GUI isn’t going to update until you get out of it and back in).
Which leads me to a potential solution for you. First you need to go through the steps above to find the correct path to use. It’s possible it’s the same as mine, but I don’t know. Once you ahve that, you can use PowerShell to do things in the registry.
Working with registry keys - PowerShell | Microsoft Learn and Working with registry entries - PowerShell | Microsoft Learn
Getting the current value:
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{a9b18bd2-0466-4251-ac78-fc1b6d4e9353}\' -Name DeviceState
You may need to replace the GUID as I mentioned before. and to set it:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{a9b18bd2-0466-4251-ac78-fc1b6d4e9353}\' -Name DeviceState -Value 1
And on course, the issues don’t stop there even though I could change it in the registry (opened as an admin) I could not via powershell with that same account (PS running as an admin). This appears to be common: Cannot set-itemproperty in registry : PowerShell (reddit.com). That thread talks about ways other people have worked around the issue. What’s strange is for me, by default, admins have the ability to set values and it definitely works in the GUI:
Alas, you may have to play around with it some but that technically should get you where need to be. I don’t know if it’s worth the hassle personally, but you might try to do some more googling on it.