Automatically switch your Windows default audio output when you put on or take off your Logitech PRO X 2 Lightspeed headset.
- PRO X 2 powered on → Windows uses the headset output.
- PRO X 2 powered off → Windows falls back to your alternative output (e.g. PC speakers).
- The LIGHTSPEED dongle can stay plugged in.
- Runs in the background with no PowerShell window at login.
See it live on the project page.
Wireless headsets keep their USB/LIGHTSPEED endpoint visible to Windows even when the physical headset is turned off. So Windows doesn't know it should switch back to your speakers.
The manual dance got old fast:
- Take off the headset.
- Open the sound settings.
- Change the default output.
- Put the headset back on.
- Repeat.
This project removes that friction: switch the output just by turning the headset on or off.
Tested on 2026-08-07: while the PRO X 2 is powered on, Logitech G HUB's battery query returns a payload; when powered off, it doesn't; power on again and it comes back. AutoSwitch uses that signal.
PRO X 2
│
▼
Logitech G HUB
ws://localhost:9010
│
├── GET /devices/list
│ └── locate the PRO X 2 extendedDisplayName
│
└── GET /battery/<deviceId>/state
│
├── payload present -> ON
└── payload absent -> OFF
│
▼
SoundVolumeCommandLine
│
/SetDefault <Item ID> all
│
▼
Windows
- Windows 10/11 x64.
- Logitech G HUB installed, open, and recognizing the PRO X 2.
- Internet connection during install (downloads
svcl.exefrom NirSoft). - PowerShell 5.1 or newer.
No admin rights should be required for normal operation.
One click (downloads the latest release ZIP and its SHA-256 checksum, verifies the ZIP before extracting, then runs the full installer):
powershell.exe -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/Ayerdi/PROX2-AutoSwitch/main/install.ps1 | iex"Or manually:
- Install Logitech G HUB and confirm it detects the PRO X 2.
- Extract the whole ZIP to a normal folder. Don't run the installer from inside the ZIP.
- Open PowerShell in that folder.
- If Windows blocked the downloaded scripts:
Get-ChildItem . -Filter *.ps1 | Unblock-File- Run:
powershell.exe -ExecutionPolicy Bypass -File ".\Instalar-PROX2-AutoSwitch.ps1"The installer will:
- download SoundVolumeCommandLine from NirSoft;
- verify its SHA-256 before running it;
- connect to G HUB at
ws://localhost:9010; - locate the PRO X 2;
- ask you to manually select the headset as the default output;
- capture the real Item ID of the current Windows;
- ask you to select the alternative output;
- capture its Item ID;
- actually test both switches;
- save the configuration;
- install the runtime;
- create an invisible autostart entry via
wscript.exe; - start AutoSwitch.
Windows audio Item IDs are not reused across installs. The installer is designed to capture them from your current Windows. Don't copy config.json from another machine.
The dev000000XX ID from G HUB isn't persisted either. The runtime keeps the extendedDisplayName and discovers the current deviceId at startup.
The PowerShell scripts are the original working versions and their on-screen messages are in Spanish. They work unchanged on any locale; only the UI text is Spanish.
%LOCALAPPDATA%\PROX2AutoSwitch\
Main contents:
PROX2AutoSwitch.ps1
config.json
svcl.exe
Iniciar-Oculto.vbs
autoswitch.log
Desinstalar-PROX2-AutoSwitch.ps1
Verificar-PROX2-AutoSwitch.ps1
Autostart is created in the user's Startup folder as:
PRO X 2 AutoSwitch.lnk
That shortcut runs wscript.exe, which starts PowerShell hidden — no console window at login.
powershell.exe -ExecutionPolicy Bypass -File ".\Verificar-PROX2-AutoSwitch.ps1"Or use the installed copy:
powershell.exe -ExecutionPolicy Bypass -File "$env:LOCALAPPDATA\PROX2AutoSwitch\Verificar-PROX2-AutoSwitch.ps1"Manual test:
- Power on the PRO X 2.
- Wait ~1–2 seconds.
- Windows should select the headset.
- Power them off.
- After two consecutive checks (~3 seconds), Windows should select the alternative output.
Two consecutive empty responses are required before treating the headset as off, to avoid flapping on a one-off G HUB response.
%LOCALAPPDATA%\PROX2AutoSwitch\autoswitch.log
Expected example:
PRO X 2 AutoSwitch iniciado.
PRO X 2 detectado por G HUB: PRO X 2 Lightspeed Gaming Headset (dev...)
Conectado con G HUB.
Salida cambiada -> ...
Salida cambiada -> ...
From the package:
powershell.exe -ExecutionPolicy Bypass -File ".\Desinstalar-PROX2-AutoSwitch.ps1"or from the installation:
powershell.exe -ExecutionPolicy Bypass -File "$env:LOCALAPPDATA\PROX2AutoSwitch\Desinstalar-PROX2-AutoSwitch.ps1"svcl.exe /GetColumnValue already writes the value to stdout. Do not use:
svcl.exe /Stdout /GetColumnValue ...In an earlier implementation /Stdout prepended item info (1 item found:, name, etc.) and corrupted the Item ID, so /SetDefault got an invalid identifier and answered No items found.
The correct form used in this version is:
svcl.exe /GetColumnValue "DefaultRenderDevice" "Item ID"then extract only:
{0.0.0.00000000}.{GUID}
- The G HUB WebSocket
localhost:9010is not an officially supported Logitech API. It's a reverse-engineered local interface used by third-party projects. Logitech can change it in future G HUB releases. If it stops working after a G HUB update, seeAGENT.md. - The installer downloads
svcl-x64.zipfrom NirSoft and verifies its SHA-256. If NirSoft ships a new version the hash may change and the installer fails safely. Don't remove that check.
install.ps1— one-click bootstrap: fetches the latest release ZIP and its.sha256, verifies the hash, then runs the installer.Instalar-PROX2-AutoSwitch.ps1— clean install from scratch.Runtime-PROX2-AutoSwitch.ps1— the runtime copied to%LOCALAPPDATA%.Desinstalar-PROX2-AutoSwitch.ps1— removes process, autostart and files (with truthful per-step reporting).Verificar-PROX2-AutoSwitch.ps1— quick diagnostics.lib/AutoSwitchCore.psm1— shared pure logic (Item ID extraction, OFF debounce, config validation) used by installer, runtime and tests.tests/— Pester coverage for the pure logic.site/— the GitHub Pages site, ES/EN.AGENT.md— context so an AI agent can maintain/rebuild the project.SOURCES.md— verified technical references.SECURITY.md— security scope and how to report a vulnerability.CHANGELOG.md— version history (Keep a Changelog)..github/workflows/validate.yml— CI: PowerShell syntax, PSScriptAnalyzer, Pester..github/workflows/pages.yml— CI that deployssite/to GitHub Pages..github/workflows/release.yml— builds the release ZIP +.sha256onv*tags.
