0

It's Win10 or 11 and I've seen the below for increasing/decreasing the volume 2% each time it's called, however I'd like to get/set the System Sounds volume, or the Device (master) Volume. Is that possible in Powershell?

const uint WM_APPCOMMAND = 0x319;
const uint APPCOMMAND_VOLUME_UP = 0xA0000;
const uint APPCOMMAND_VOLUME_DOWN = 0x90000;
const uint APPCOMMAND_VOLUME_MUTE = 0x80000; 

Win32.Win32.SendMessage(handy, WM_APPCOMMAND, handy, (IntPtr)APPCOMMAND_VOLUME_UP);

Win32.Win32.SendMessage(handy, WM_APPCOMMAND, handy, (IntPtr)APPCOMMAND_VOLUME_DOWN);

enter image description here

Bbb
  • 517
  • 6
  • 27

1 Answers1

0

The AudioDeviceCmdlets module in powershell that can be used to manage sound devices and volume level.

And you could also try to use Core Audio APIs to control the system volume. And then you could access the [Audio]::Volume property from PowerShell.

I suggest you could refer to the threads:

https://stackoverflow.com/a/19348221/11872808

https://stackoverflow.com/a/31751275/11872808

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20