This repository contains two PowerShell scripts to manage audio device volume and mute states on Windows. The scripts use the AudioDeviceCmdlets PowerShell module to control the default playback audio device.
SetVolume70.ps1:
- Sets the default playback device volume to 70%.
- Ensures the device is unmuted.
MuteVolume1.ps1:
- Sets the default playback device volume to 1%.
- Mutes the device.
Install the AudioDeviceCmdlets Module
- Open PowerShell with administrative privileges.
- Install the
AudioDeviceCmdletsmodule:Install-Module-Name AudioDeviceCmdlets -Scope CurrentUser
- Import the module into your session:
Import-Module AudioDeviceCmdlets - Verify installation:
Get-Command-Module AudioDeviceCmdlets
Run the SetVolume70.ps1 script:
.\SetVolume70.ps1What it does:
- Sets the default playback device's volume to 70%.
- Unmutes the playback device.
Run the MuteVolume1.ps1 script:
.\MuteVolume1.ps1What it does:
- Sets the default playback device's volume to 1%.
- Mutes the playback device.
You can use Task Scheduler to automate the scripts:
- Open Task Scheduler (
taskschd.msc). - Create a new task:
- Set the trigger to run daily at
7:00 AM. - Set the action to run PowerShell:
powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\SetVolume70.ps1"
- Set the trigger to run daily at
- Repeat the steps above, but:
- Set the trigger to run daily at
10:30 AM. - Use the path to
MuteVolume1.ps1in the action.
- Set the trigger to run daily at
You can modify the scripts to log their actions by appending output redirection:
Set-AudioDevice-PlaybackVolume 70>"C:\Path\To\Log_SetVolume70.txt"2>&1Set-AudioDevice-PlaybackMute $true>"C:\Path\To\Log_MuteVolume1.txt"2>&1Module Not Found:
- Ensure
AudioDeviceCmdletsis installed and imported.
- Ensure
Permissions:
- Run PowerShell with administrative privileges for best results.
Device Not Detected:
- Use the following to check available devices:
Get-AudioDevice-List
- Use the following to check available devices:
AudioDeviceCmdlets: PowerShell module for managing audio devices.
Feel free to fork this repository and submit pull requests for improvements or additional functionality.
This project is licensed under the MIT License.