powershell and arduino serial communication

After struggling to get a bash script to send data from curl correctly to my arduino over serial I resorted to windows and found that communication over serial can be quickly achieved using the Powershell (the new cmd). I naively assumed it would be easier in linux than windows however the Powershell does seem to be quite a match for bash. I achieved what had taken me hours in Linux in about 10 minutes. The following example code shows the connection to the arduino and how to send data to any serial device This can of course be formed into a more sophisticated script or just run line by line:

$port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one #opens serial port - adjust parameters accordingly
$port.open() #opens serial connection
$port.Write("Hello World") #writes your content to the serial connection
$port.Close() #closes serial connection

If you are not sure of the name of your serial ports then you can list them in the powershell:

[System.IO.Ports.SerialPort]::getportnames()