Play with Speech Synthesizer using PowerShell and Node JS

This blog post is to demo the speech synthesizer using PowerShell. What’s new? Well nothing, except blending the PowerShell script with Node JS. To know about Speech Synthesizer refer MSDN – Reference for PowerShell is captured in idera PowerShell Tip (Speech-Week) Yes, this reminded a project I delivered for one of our Dutch customer!

Now, it’s time to click and convert text to speech! Let’s make it as simple as possible! The speech page is illustrated below!

PowerShell Script

Pretty straight forward! The script accepts a parameter $Text and we pass value from our node web application.


We have created two routes i.e GET and POST for ‘/Speech’ where the GET renders the speech.pug and POST calls the PowerShell script. Closer look to pass the value for the PowerShell parameter


Use your favorite bootstrap to make your web application glossy! See you all in my next blog post! Enjoy PowerShell!


Indeed, many moved to SNOW (servicenow) and enjoying it where in few customers are still using legacy products! In my work place snow is in proof of concept stage. Like many automation enthusiast I love to explore both REST and SOAP for solving customer requirements. In this article I will walk you through the steps to consume HPSM soap web service and publish it as REST end points.

If you aren’t new to PowerShell then you must have come across the Hey Scripting Guy Post – Use PowerShell to retrieve a weather forecast!  Yes, nothing much I will explain here and in fact I follow the same foot-steps for our PowerShell script to work with HPSM SOAP Web Service.

To begin with let us explore the PowerShell script to query incidents by ID. Here the ID is valid HPSM incident ID which has a format like IM12345

Cool! It works and for now don’t worry about performance. We have plenty of ways to fine tune this code which will be covered in my next upcoming blogs!

Node Application

It’s time for us to build a node application and distribute the solution as REST endpoint in on premise server. Yes, the HPSM web service we used is cloud hosted application and managed by third party vendor(s).

Using the built in module ‘child-process’ we called PowerShell.exe and passed the script file path as argument. That’s it! Rest is our fruitful result!

Output is as shown below

Using Express Framework

In the preceding example we successfully got the output in the console. Now, we need to get this working in our web server. After a bit of trial and error I figured out the easier method!

Browse to http://localhost:3000 to see the result


If you observed the code carefully we used static value for the incident ID. So we need to tweak our code little bit! Just parameterize your PowerShell script as illustrated below

And your server.js will look like below

It’s really simple! Browse to http://localhost:3000/incidentid/IM12345 to see the same result 🙂

Deploy it as Windows Service

For this I used qckwinsvc.cmd which is really very handy. After installing the qckwinsvc from npm globally – Just use it

Now our service is up and running