Home > Net >  Powershell: How to iterate and set Sound Playback and Sound Input device?
Powershell: How to iterate and set Sound Playback and Sound Input device?

Time:02-11

Well, one of the things that is worse in Win11 is that it is now several clicks to change audio playback device (where in Win10 it was two or three clicks).

Time to script it.

What is the method in powershell to:

  • List audio output and input devices
  • Set/change the audio output and input devices

CodePudding user response:

I am not sure if its gonna work on Windows 11 but its worth a try.

There is a module in powershell that can be used to manage sound devices and volume level. Try AudioDeviceCmdlets module from the PSGallery https://www.powershellgallery.com/packages/AudioDeviceCmdlets/3.0.0.4

Then you can use Get-AudioDevice -List to see the available audio devices, and Set-AudioDevice <AudioDevice> -index 1 to set the desired "AudioDevice" to be the default input/output.

More on the module here - https://github.com/frgnca/AudioDeviceCmdlets

  • Related