Author Posts

May 16, 2017 at 3:46 am

I'm working on a script, to go and unmute the speaks on a local or remote computer, send a message using [Speech] Class
I'll show you the code below. But I was wondering if it's possible to use PowerShell to capture a (Record) Microphone input ??

# Set Speaker function
Function Set-Speaker($Volume) {
$wshShell = new-object -com;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | %{$wshShell.SendKeys([char]175)}}
Set-Speaker -Volume 50
Invoke-Command -ComputerName $PC -scriptblock {

Add-Type -AssemblyName System.speech
$talker = New-Object System.Speech.Synthesis.SpeechSynthesizer
$talker.speak("Hi there .. Your your password expires today. Please change your password now")

May 16, 2017 at 12:59 pm

So, because I know there's no PowerShell command for this, I searched ".NET record microphone". You might try that – there are some good examples. You're going to need to translate from C# or VB, because you're basically going to be coding .NET.

FWIW, I also searched ".net set volume" and got some good results, which might give you something more reliable than that SendKeys approach you're using. That's almost 20 years old and isn't going to be reliable across a lot of different systems.

May 16, 2017 at 6:56 pm

You're correct. I tried to invoke the SendKeys didn't work on all of the AD machines.
Instead I used "InteropServices"; interface "IAudioEndpointVolume" and It works 🙂

As for Mic. I found some good C# examples ..