Windows Server

Do-Speak: Start talking with Remote Computers (System.Speech)

In this article I’ll show you how to use a very simple command that works for the local computer and remote computers and lets your computers speak.

Sometimes I have strange ideas. I found the System.Speech Class, and used it for let my computer speak. Some of you may have read my other article about informing users with text messages that I’ve described here: Active Directory: Send Messages to all currently logged on Users (msg.exe). Now we do something different, we inform our users with “Remote Talking”.

Function Do-Speak

Do-Speak enables you to let your computer speak something. Do-Speak also supports remote speaking. That said, you are able to send a text message to a remote computer which will then output your message via audio. Make sure Windows Remotemanagement (WinRm) is enabled on your client computers. In Windows Server 2012 and above it’s enabled by default. More about enabling WinRm with GPO see here:


Local Computer



Remote Computer

When you send your audio text message to a remote computer you usually have to authenticate with an administrator account. Therefore I’ve implemented a command to ask you for your credentials before you can send the message.

And here in action:

Do-Speak -Computer client01



The function Do-Speak

Copy this code in PowerShell ISE and press the green button. Have fun with it.

Function Do-Speak {






If (!$computer)


$Text=Read-Host 'Enter Text'

[Reflection.Assembly]::LoadWithPartialName('System.Speech') | Out-Null
$object = New-Object System.Speech.Synthesis.SpeechSynthesizer


else {


$PS=New-PSSession -ComputerName $Computer -Credential $cred

Invoke-Command -Session $PS {
$Text=Read-Host 'Enter Text'

[Reflection.Assembly]::LoadWithPartialName('System.Speech') | Out-Null
$object = New-Object System.Speech.Synthesis.SpeechSynthesizer



Make it permanent

If you like my approach open PowerShell ISE. Copy the function into your ISE session. Create a folder in C:\Program Files\Windows PowerShell\Modules and save the code as psm1 file. Make sure that your file name and folder name match.


From now on, PowerShell will load the custom module at startup.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s