Skip to content

Instantly share code, notes, and snippets.

@SavageBeef
Forked from x0rp01s0n/SetDefaulDeviceOnConnection.xml
Last active March 3, 2026 00:25
Show Gist options
  • Select an option

  • Save SavageBeef/ae722fd21b7acd8111fbf6cc48b565b8 to your computer and use it in GitHub Desktop.

Select an option

Save SavageBeef/ae722fd21b7acd8111fbf6cc48b565b8 to your computer and use it in GitHub Desktop.

Persistent Default Audio Device Switcher

๐Ÿ› ๏ธ Fork Update: Voicemeeter v3.1.2.2 (Dec 2025)

Tested on Windows 11 25H2 with SoundVolumeView v2.51.

Key Changes:

  • Improved Import Compatibility: Eliminated the need to manually update the user account after importing.
  • Hardware Mapping: Updated for new virtual cable naming conventions; added B1 as a default input.
  • Trigger Optimization: Migrated the trigger to Microsoft-Windows-Audio/Operational (Event ID 65) for significantly better reliability.

๐Ÿš€ Quick Start

1. Prepare the Utility

  1. Open File Explorer, navigate to C:\, and create a folder named Temp.
  2. Download SoundVolumeView: Go to the NirSoft website (download links are near the bottom of the page).
  3. Place SoundVolumeView.exe into the Temp folder.
    • Final Path: C:\Temp\SoundVolumeView.exe

2. Identify Your Device ID

  1. Run C:\Temp\SoundVolumeView.exe.
  2. Locate your preferred device in the list:
    • Render: Output devices (Speakers, Headphones, Voicemeeter Input).
    • Capture: Input devices (Microphones, Voicemeeter Output).
  3. Double-click your device name.
  4. Find the field labeled Command-Line Friendly ID and copy the entire string inside that box.

3. Import & Configure the Task

  1. Press WIN + R, type taskschd.msc, and hit Enter.
  2. Click Import Task... in the right-hand Actions pane.
  3. Select the SetDefaulDeviceOnConnection.xml file provided in this Gist.
  4. In the properties window that opens, navigate to the Actions tab.
  5. You will see six "Start a program" entries. For each one:
    • Select the entry and click Edit.
    • In the Add arguments box, find the /SetDefault command.
    • Replace the ID between the quotes "" with your copied Command-Line Friendly ID.
  6. Click OK to save the changes.

๐Ÿ”ง Maintenance

If you change your hardware or Voicemeeter setup later, simply find the saved task in your Task Scheduler Library and update the IDs in the Actions tab as described in Step 3.

Enjoy! Windows will no longer be able to hijack the devices youโ€™ve decided as default. ๐Ÿ˜‰

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>NULL234\null234</Author>
<URI>\SetDefaulDeviceOnConnection</URI>
<Description>Stop annoying Windows! I want to decide what default Playback/Recording device I use.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>
&lt;QueryList&gt;
&lt;Query Id="0" Path="Microsoft-Windows-Audio/Operational"&gt;
&lt;Select Path="Microsoft-Windows-Audio/Operational"&gt;
*[System[(EventID=65)]]
&lt;/Select&gt;
&lt;/Query&gt;
&lt;/QueryList&gt;
</Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Input\Render" 0</Arguments>
</Exec>
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Input\Render" 1</Arguments>
</Exec>
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Input\Render" 2</Arguments>
</Exec>
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Out B1\Capture" 0</Arguments>
</Exec>
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Out B1\Capture" 1</Arguments>
</Exec>
<Exec>
<Command>C:\Temp\SoundVolumeView.exe</Command>
<Arguments>/SetDefault "VB-Audio Voicemeeter VAIO\Device\Voicemeeter Out B1\Capture" 2</Arguments>
</Exec>
</Actions>
</Task>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment