Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rrazgriz/c10cfbf95fab848f2100b0f19964a0d1 to your computer and use it in GitHub Desktop.
Save rrazgriz/c10cfbf95fab848f2100b0f19964a0d1 to your computer and use it in GitHub Desktop.
Windows Task: Restart Voicemeeter any time an audio device's state changes. Voicemeeter's "Auto Restart Audio Engine" is supposed to do this automatically but it doesn't work most of the time for me. Tested with VoiceMeeter Potato on Win10 22H2. Installation: Click raw, save as .xml file, Open Windows Task Scheduler, Click "Task Scheduler Librar…
<?xml version="1.0" encoding="UTF-16"?>
<!--
SPDX-License-Identifier: CC0-1.0
Download: Right click "Raw" (top right) -> Save As... (or Save Link As...)
Installation: Open Windows Task Scheduler, Click "Task Scheduler Library" on left, Menu Bar -> Action -> Import Task... -> Navigate to file
Change the path to VoiceMeeter in Actions if you installed it somewhere else.
-->
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Description>Restart Voicemeeter any time an audio device's state changes.
Useful for frequently connecting/disconnecting audio devices.</Description>
<URI>Voicemeeter Restart on Audio Device State Change</URI>
</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[Provider[@Name='Microsoft-Windows-Audio'] and EventID=65]] and *[EventData[Data[@Name='NewState']='1']]&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>false</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>true</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"C:\Program Files (x86)\VB\Voicemeeter\voicemeeter.exe"</Command>
<Arguments>-r</Arguments>
</Exec>
</Actions>
</Task>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment