Skip to content

Instantly share code, notes, and snippets.

@rgov
Last active August 8, 2024 00:34
Show Gist options
  • Save rgov/ffd8e91036ab97fbec4419381c829c13 to your computer and use it in GitHub Desktop.
Save rgov/ffd8e91036ab97fbec4419381c829c13 to your computer and use it in GitHub Desktop.
Workaround for the Oculus Virtual Audio Device hijacking your audio on boot

There is a longstanding issue with the Oculus software which causes the Oculus Virtual Audio Device to commandeer audio output on Windows on every boot, even if no Oculus headset is attached to the computer.

Tip

Hey Meta, your tech support is atrocious.

This PowerShell script resets the audio device to my desired device ("AV Receiver"). It waits a few minutes in case Oculus doesn't hijack the audio device immediately. You can schedule this to run on startup using the Task Scheduler: powershell.exe -ExecutionPolicy Bypass -File "C:\...\Fix Default Audio Device.ps1".

# Install AudioDeviceCmdlets if necessary
$module = Get-Module -ListAvailable -Name AudioDeviceCmdlets
if (-not $module) {
Install-Module -Name AudioDeviceCmdlets -Force -Scope CurrentUser
}
# Repeatedly check if the Oculus audio device has been selected
$endTime = (Get-Date).AddMinutes(5)
while ((Get-Date) -lt $endTime) {
$oculusDevice = Get-AudioDevice -Playback | Where-Object { $_.Name -like "*Oculus*" }
if ($oculusDevice) {
break
}
Start-Sleep -Seconds 1
}
if (-not $oculusDevice) {
exit
}
# Reset the audio device to the one I want
$devices = Get-AudioDevice -List | Where-Object { $_.Name -like "AV Receiver*" }
if ($devices) {
Set-AudioDevice -Id $devices[0].Id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment