How to deploy Python via GPO (Group Policy Object)

Installing Python via GPO and unattend mode is sometimes difficult. In this article, we will describe its process in detail.

Silent install Python

If you are using SCCM, Intune, or other software deployment tools that support the .exe format, or if you want to install silently through the console, then use the silent installation parameters that are described in the table (silent install command Python table) . In this case, you should use standard deployment methods.

Now let’s look at the steps for installing Python on computers on the network using GPO and various utilities to help with this.

Installing python using GPO(Group Policy Object)

The GPO does not recognize executable files in the .exe format as installation tools, but there are two workarounds for this problem:

  1. Creating .bat files which are Windows command line batch scripts
  2. Packing a program or script in Windows Installer format (.msi)

The second installation method is preferable because it allows you to create complete installation packages, which can be more convenient and flexible for deploying programs on an organization’s network using Group Policy Objects.

Packing python in msi for GPO.

  1. Create an installation file  with Silent Install Builder.
  2. Create a new package and give it a name.
  3. Click ‘Add’ and select ‘Script Action’
Creating an msi to install python via GPO.
  1. In the “Script Action” window that opens, enter the folder location in the “Additional Files” field

in which there is a file and in 1 line ‘Sib.ExecuteProcessNoWait(“1”, “2”);’, where instead of ‘1’ specify the name of the Python installer, and instead of ‘2’ specify the Python installation parameters (for a standard installation, ‘/quiet InstallAllUsers=1 PrependPath=1’ is sufficient) click OK to save the operation

Sib.ExecuteProcessNoWait("1", "/quiet InstallAllUsers=1 PrependPath=1");

Code to start python silent mode.
  1. Then click ‘Build Package’.
  1. Select ‘Deployment with GPO (.msi)’ as the deployment method.
Building a python package into an msi file.
  1. Next, you just need to add the generated .msi file to the installation system.

Previous article: How to install a GPO.
See also:

Silent Install Builder 6 Documentation

How to deploy an exe-file using Group Policy (exe to gpo)

Other software at