Powershell script to check if Python is installed
<p>I'm trying to check if Python is installed on a machine via a Powershell script.</p>

<p>My idea so far is to run the following:</p>

<pre><code>$p = iex 'python -V'
</code></pre>

<p>If the command executes correctly (check the <code>Exitcode</code> on <code>$p</code> property), read the output and extract the version number.</p>

<p>However, I'm struggling to capture the output when executing the script in Powershell ISE. It's returning the following:</p>

<pre><code>python : Python 2.7.11
At line:1 char:1
+ python -V
+ ~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Python 2.7.11:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
</code></pre>

<p>Can someone point in the right direction? </p>

<p>Cheers,
Prabu</p>