By adding a new system type called System.Speech, you can make PowerShell speak out loudly:
Add-Type -AssemblyName System.Speech $synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer $synthesizer.Speak('Hey, I can speak!')
This .NET approach can replace the old COM-based approach occasionally used:
$oldstuff = New-Object –COMObject SAPI.SpVoice $oldstuff.Speak(‘Hey, I can speak!’) | Out-Null
The .NET code can do much more, supports lexicons and provides more information. This line will list the voices installed on your system for example:
$synthesizer.GetInstalledVoices() | ForEach-Object { $_.VoiceInfo }