How to capture (record) microphone input

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Del Del 6 days, 19 hours ago.

  • Author
    Posts
  • #70709
    Profile photo of Del
    Del
    Participant

    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 wscript.shell;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")
    }

  • #70735
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

    • #70805
      Profile photo of Del
      Del
      Participant

      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 ..

You must be logged in to reply to this topic.