I'm trying to check if Python is installed on a machine via a Powershell script.
My idea so far is to run the following:
$p = iex 'python -V'
If the command executes correctly (check the Exitcode
on $p
property), read the output and extract the version number.
However, I'm struggling to capture the output when executing the script in Powershell ISE. It's returning the following:
python : Python 2.7.11
At line:1 char:1
+ python -V
+ ~~~~~~~~~
+ CategoryInfo : NotSpecified: (Python 2.7.11:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Can someone point in the right direction?
Cheers, Prabu