Install AudioDeviceCmdlets via PowerShell
masterTo install the AudioDeviceCmdlets module, run PowerShell as an administrator and use the Install-Module command.
Install-Module -Name AudioDeviceCmdletsrepository·master·Indexed 21 days ago
https://github.com/frgnca/audiodevicecmdletsA PowerShell module for granular control over Windows audio devices. It provides cmdlets to manage default playback and recording devices, adjust volume and mute states, and monitor audio output and input levels via Get-AudioDevice, Set-AudioDevice, and Write-AudioDevice.
To install the AudioDeviceCmdlets module, run PowerShell as an administrator and use the Install-Module command.
Install-Module -Name AudioDeviceCmdletsIf you need to build the module from source, follow these steps:
SOURCE folder using File -> New -> Project From Existing Code... (Type: Visual C#). Set the Output type to Class Library.AudioDeviceCmdlets.NET Framework 4.6.1+Microsoft.PowerShell.5.1.ReferenceAssemblies NuGet package (v1.0.0+).Release and build the solution to generate AudioDeviceCmdlets.dll..dll to your PowerShell modules directory and import it.# Example import steps after building
$FilePath = "C:\Path\To\AudioDeviceCmdlets\SOURCE\bin\Release\AudioDeviceCmdlets.dll"
New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
Copy-Item $FilePath "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets"
Get-ChildItem | Unblock-File
Import-Module AudioDeviceCmdletsUse Set-AudioDevice to change the default audio device (playback or recording) and its communication role. You can also control volume and mute states for default devices.
# Set a specific device as both default and default communication
Set-AudioDevice <AudioDevice>
# Set a device as default communication only
Set-AudioDevice <AudioDevice> -CommunicationOnly
# Set a device as default playback only
Set-AudioDevice <AudioDevice> -DefaultOnly
# Toggle mute for the default playback device
Set-AudioDevice -PlaybackMuteToggle
# Set volume for the default recording device (0-100)
Set-AudioDevice -RecordingVolume 50
# Set mute state for the default communication playback device
Set-AudioDevice -PlaybackCommunicationMute $trueUse Get-AudioDevice to retrieve information about audio devices. You can query by specific ID, Index, or use flags to get the default playback, recording, or communication devices and their current states (volume/mute).
# Get a list of all enabled devices
Get-AudioDevice -List
# Get the default playback device
Get-AudioDevice -Playback
# Get the default playback device's volume (0-100)
Get-AudioDevice -PlaybackVolume
# Get the default playback device's mute state
Get-AudioDevice -PlaybackMute
# Get a specific device by ID or Index
Get-AudioDevice -ID <string>
Get-AudioDevice -Index <int>Use Write-AudioDevice to monitor the power output (meter) or the raw stream of data for playback or recording devices. This is useful for visualizing audio levels.
# Get a meter of the default playback device's power output (0-100)
Write-AudioDevice -PlaybackMeter
# Get a stream of integers representing the default playback device's power output
Write-AudioDevice -PlaybackStream
# Get a meter of the default recording device's power output
Write-AudioDevice -RecordingMeter