Need help with AudioDeviceCmdlets?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

frgnca
251 Stars 36 Forks MIT License 59 Commits 15 Opened issues

Description

AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows

Services available

!
?

Need anything else?

Contributors list

Description

AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows

Features

Get list of all audio devices
Get default audio device (playback/recording)
Get volume and mute state of default audio device (playback/recording)
Set default audio device (playback/recording)
Set volume and mute state of default audio device (playback/recording)

Import Cmdlet to PowerShell

Download AudioDeviceCmdlets.dll

powershell
New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
Copy-Item "C:\Path\to\AudioDeviceCmdlets.dll" "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets"
Get-ChildItem | Unblock-File
Import-Module AudioDeviceCmdlets

Usage

Get-AudioDevice -List             # Outputs a list of all devices as 
                -ID       # Outputs the device with the ID corresponding to the given 
                -Index       # Outputs the device with the Index corresponding to the given 
        -Playback         # Outputs the default playback device as 
                -PlaybackMute     # Outputs the default playback device's mute state as 
                -PlaybackVolume   # Outputs the default playback device's volume level on 100 as 
                -Recording        # Outputs the default recording device as 
                -RecordingMute    # Outputs the default recording device's mute state as 
                -RecordingVolume  # Outputs the default recording device's volume level on 100 as 
Set-AudioDevice              # Sets the default playback/recording device to the given , can be piped
                -ID               # Sets the default playback/recording device to the device with the ID corresponding to the given 
                -Index               # Sets the default playback/recording device to the device with the Index corresponding to the given 
                -PlaybackMute       # Sets the default playback device's mute state to the given 
                -PlaybackMuteToggle       # Toggles the default playback device's mute state
                -PlaybackVolume    # Sets the default playback device's volume level on 100 to the given 
                -RecordingMute      # Sets the default recording device's mute state to the given 
                -RecordingMuteToggle      # Toggles the default recording device's mute state
                -RecordingVolume   # Sets the default recording device's volume level on 100 to the given 
Write-AudioDevice -PlaybackMeter  # Writes the default playback device's power output on 100 as a meter
                  -PlaybackSteam  # Writes the default playback device's power output on 100 as a stream of 
                  -RecordingMeter # Writes the default recording device's power output on 100 as a meter
                  -RecordingSteam # Writes the default recording device's power output on 100 as a stream of 

Build Cmdlet from source

  1. Using Visual Studio Community, create new project from SOURCE folder
    File -> New -> Project From Existing Code...

    Type of project: Visual C#
    Folder: SOURCE
    Name: AudioDeviceCmdlets
    Output type: Class Library
    
  2. Install System.Management.Automation NuGet package
    Project -> Manage NuGet Packages...

    Browse: System.Management.Automation
    Install: v6.3+
    
  3. Set project properties
    Project -> AudioDeviceCmdlets Properties...

    Assembly name: AudioDeviceCmdlets
    Target framework: .NET Framework 4.5+
    
  4. Set solution configuration
    Build -> Configuration Manager...

    Active solution configuration: Release
    
  5. Build Cmdlet
    Build -> Build AudioDeviceCmdlets

    AudioDeviceCmdlets\bin\Release\AudioDeviceCmdlets.dll
    

Attribution

Based on code posted to Code Project by Ray Molenkamp with comments and suggestions by MadMidi
http://www.codeproject.com/Articles/18520/Vista-Core-Audio-API-Master-Volume-Control
Based on code posted to GitHub by Chris Hunt
https://github.com/cdhunt/WindowsAudioDevice-Powershell-Cmdlet

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.