In this documentation, we will explain how to install Python on the remote windows machine. We achieve this by invoking the app action node with the following configuration:
App Node: Powershell - Orch
App Action: Execute Command
The ‘command’ input, is the Powershell command to install Python on the remote windows machine, as following -
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe" -OutFile "c:/temp/python-3.7.0.exe";
c:/temp/python-3.7.0.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0;
There are three commands which we will be using for Python installation.
In the first part of the command, we set the TLS (Transport Layer Security) for web requests, PowerShell by default, uses TLS 1.0 for web requests. In case TLS 1.0 doesn’t work, you may get the following error response from Powershell.
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At line:1 char:1
+ Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.7.0/pytho ...
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
To resolve this error, we set the TLS version to 1.2 with the following command:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
This will force the use of TLS 1.2 (you can also make it use 1.1 if you want for some reason).
In the second part of the command, we invoke a web request to download the Python installer and save it to the C:/temp directory.
In the third command statement, we execute the downloaded installer for Python and supply the following command-line arguments for the installer to make the installation silent. Marking the installation as silent will ensure that there is no user input interrupts during installation. If there are user interruptions during the installation, the execution will fail.