On a recent MDT project the client requested to finish all builds with volume set at 30%.

 

Being committed to doing everything in Powershell, I jumped on the book of knowledge looking for some inspiration. As luck would have it, I found this response from knuckle-dragger that performed the complete task perfectly for me.

 

Below is the PowerShell script that meets my clients ’need’…

 

Function Set-Speaker($Volume){
  $wshShell = new-object -com wscript.shell;1..50 | % {
    $wshShell.SendKeys(\[char\]174)};1..$Volume | % {$wshShell.SendKeys(\[char\]175)
  }
}
Set-Speaker -Volume 15

 

I save this as a ps1 and execute this as a Powershell Script towards the end of the task sequence and the volume magically gets set to 30%.

If my little function doesn’t suit your desires, this script from MS Script Center or this script from the scripting guys might be helpful

Enjoy, Dan

Daniel Apps

Hi, I'm Daniel Apps — AI platform enthusiast, unapologetic infrastructure nerd, and dad to two small humans. I write about infrastructure, AI industry topics, and the real-world chaos of modern IT.

More about me →

s