title: How to send Date/Time to COM-Port via Powershell?
body: <p>i'm just sitting in front of the windows cmd shell and opened a COM-port via powershell to send some information to an external device. if i type the following code into the shell everything works perfectly:</p>
  
  <pre><code>    powershell
      $port=new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one
      $port.open(
      $port.WriteLine("Hello world")
      $port.Close()
  </code></pre>
  
  <p>But now i want to send date and time to the port, so i thought i just need to change the 5th line:</p>
  
  <pre><code>    $port.WriteLine(Get-Date)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>    $port.WriteLine($Get-Date)
  </code></pre>
  
  <p>but that doesn't work (the shell tells me some weird stuff in red letters) and i have no idea so far how this could be done...
  can anyone help me?</p>