Basic scrict to automate a transition between two (current) profiles:
- Normal
- Microphone access OFF
- Audio output device changed to Speakers
- Meeting
- Microphone access ON
- Audio output device changed to headphones
This script uses AudioDeviceCmdlets to control the audio devices:
https://github.com/frgnca/AudioDeviceCmdlets
First import AudioDeviceCmdlets. See: https://github.com/frgnca/AudioDeviceCmdlets/blob/master/README.md#import-cmdlet-to-powershell
Then import the provided module
New-Item "$($profile | split-path)\Modules\AudioProfileSelector" -Type directory -Force
Copy-Item "C:\Path\to\AudioProfileSelector.psm1" "$($profile | split-path)\Modules\AudioProfileSelector\AudioProfileSelector.psm1"
Set-Location "$($profile | Split-Path)\Modules\AudioProfileSelector"
Get-ChildItem | Unblock-File
Import-Module AudioProfileSelector
# Sets the profile. Currently only "Normal" or "Meeting"
Set-AudioProfile <string>
The script was developed for a custom use case. The device IDs will change from machine to machine. To retrieve:
Get-AudioDevice -List | Format-Table Index, Default, Type, Id, Name