title: Call Powershell Script from Unix Shell Script
body: <p>I have a powershell script on my Windows server which does some active directory operations. I wish to call that script from another Linux machine using a shell script.</p>
  
  <p>I have installed powershell server on my Windows server and can communicate with my linux machine using <em>key based ssh authentication</em>.</p>
  
  <p>Since Windows does not support SSH connections on its own, I have installed a software called Powershell server (<a href="http://www.powershellserver.com/" rel="nofollow">http://www.powershellserver.com/</a>) on my Windows server.</p>
  
  <p>The issue is that my script just stops once the command for ssh to Windows server is executed.</p>
  
  <p>My shell script below:</p>
  
  <pre><code>#!/bin/bash
  echo "script run"
  GROUP=$1
  ACCOUNT=$2
  ssh Administrator@&lt;Windowshostname&gt;
  sleep 10
  echo "&lt;pathtoscript&gt;\scriptname.ps1 -group $GROUP -account $ACCOUNT"
  sleep 5
  echo "exit"
  exit
  </code></pre>
  
  <p>I have tried without the echo command as well and it still hangs. Any idea what I must be doing wrong here? How can I make it work please?</p>