Change Audio Output with Powershell in Windows 10

I have always wanted to change audio outputs in Windows 10 with a single key from my keyboard. I have a Steelseries Apex raw keyboard, which has a ton of macro keys, but there wasn’t a simple way to do it before. Not until I saw cdhunt’s WindowsAudioDevice-Powershell-Cmdlet. With this, I can simply create a one-line Powershell file for my Realtek Digital Output:

Set-AudioDevice -Index 3

Same goes for my Samsung TV and Acer monitor, which has inbuilt speakers. After this, I thought I was good to go, once I had set the script to one of my keyboard’s macro keys, but unfortunately Steelseries Engine 3 doesn’t support .ps1 files as executable macros. So, I had to turn to PS2EXE-GUI to turn my .ps1 files to .exe files. After this, I just had to point the macro key actions to right files and I was done.

Hopefully this helps someone else, who wants to do the same.

Tagged , , , , , , . Bookmark the permalink.

2 Responses to Change Audio Output with Powershell in Windows 10

  1. asdf says:

    I am a total noob. Can you explain this in grater detail please? does ’AudioDevice’ need to refer to a specifi device and if so how to name it / where to find it?

    Thank you!

    • Ilkka says:

      Sure.

      First you download the necessary dll file: https://github.com/frgnca/AudioDeviceCmdlets/releases/download/v3.0/AudioDeviceCmdlets.dll

      Then you do the commands to import the module in powershell cmd:

      New-Item ”$($profile | split-path)\Modules\AudioDeviceCmdlets” -Type directory -Force
      Copy-Item ”C:\Path\to\AudioDeviceCmdlets.dll” ”$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll”
      Set-Location ”$($profile | Split-Path)\Modules\AudioDeviceCmdlets”
      Get-ChildItem | Unblock-File
      Import-Module AudioDeviceCmdlets

      From here you can play around with the commands mentioned on https://github.com/frgnca/AudioDeviceCmdlets

      To get the list of audiodevices, you input ”Get-AudioDevice -List” and from there you can see the ID numbers that you can use to change the audio device.

Vastaa