How to Deploy an EXE file using Group Policy

In this tutorial, you will learn how to deploy an exe install file using group policy.

If you need to install an MSI file then check out my previous tutorial How to Deploy Software using GPO.

Group policy software deployment does not support exe files. You will need to use a script and group policy to deploy software with an exe. I’ll show you these steps below.

I do not recommend this method as it will require the users to have administrator rights and the ability to run scripts. I strongly recommend against users having either of those rights. If you must deploy an exe with group policy then try to grant temporary rights, when the deployment is done remove the rights and ability to run scripts. The preferred method would be to use a 3rd party program that can securely install software on your remote computers. Those programs can be expensive so I understand the desire to use free options. I’ve been there before and at times you have no choice due to a lack of funding or management constraints.

Steps for deploying an EXE:

Step 1: Configure a PowerShell Script

First, you need to configure a script. The script needs to check if the program is already installed if not then install it, if already installed then do nothing. I’m using PowerShell but you could also use a batch file.

Here is the script I’m using:

#Script to install exe via GPO

$folder = 'C:\Program Files\7-Zip'

if (-not (Test-Path -Path $Folder)) {
   
    start-process -FilePath "\\srvwef\software\7z2107-x64.exe" -ArgumentList '/S'

    }

else  { }

Let me explain what each line does.

$folder = 'C:\Program Files\7-Zip'

The above line sets $Folder to the directory to check if it already exists. This will be used in the next line to determine if the program is already installed. Change the path to whatever program you want to check for.

if (-not (Test-Path -Path $Folder))

This line is testing if the path of $Folder does not exist. If it doesn’t exist then it will start the install process. If it does exist it will move to the else line and do nothing.

start-process -FilePath "\\srvwef\software\7z2107-x64.exe" -ArgumentList '/S'

This line starts the installation if the $Folder does not exist. I’m using a UNC path and the /S argument so it is a silent install. Users will need access to the location of the installer.

else  {}

If the path of $Folder exists the script will move to this line and do nothing.

It’s a very basic script. You can modify it and add logging or other options. That is the nice thing about PowerShell you can customize it to your needs.

Save the script as this will be used in the next step. I saved my script as install.ps1

Step 2: Configure UNC Share

You need to have a secured distribution point for your EXE install file. It needs to be accessable for remote computers and users. I walked through on how to create a secure network share in the pervious tutorial for deploying an MSI file. Check it out if you need step by step instructions.

Step 3: Configure GPO Settings

Now let’s configure the group policy.

Create and link a new GPO to the OU containing your users. I’m going to add a new GPO to my Accounting OU.

Give the GPO a name. Then edit the GPO

Navigate to User Configuration > Windows Settings > Scripts (Logon/Logoff)

On the right side click on “Logon”.

Then click on PowerShell Scripts or Scripts if using a batch file.

Click on the Add button, then click browse.

With the browser window open you want to copy and past the .ps1 file into this window. Do not modify the path, this is the path of the GPO, and the script needs to be copied into this path. Your path will look different than mine.

Click ok and ok again. You should be back at the main screen. This completes the GPO configuration.

Step 4: Reboot Computer

Now reboot, login and the software should install.

If the software is a silent install the user will not see anything when they login, it will install in the background with no user interaction. Unless you add some logging into the script you will not know if it installs are not. That is one drawback to using group policy to install the software. If this is a method you will use long term then I would add some logging to the script to help track for failed and successful installs.

Recommended Tool: Hybrid Cloud Monitor

The Hybrid Cloud Monitor tool is designed to monitor and analyze IT infrastructure across on-premises and multi-cloud environments.

Monitor Azure, Active Directory, virtual and physical servers, manage IP addresses, log management and analysis, network flow and bandwidth graphs, and much more.

Get end-to-end visibility, analytics, and performance monitoring from a single web dashboard.

4 thoughts on “How to Deploy an EXE file using Group Policy”

  1. I need to deploy the Evergreen WebView2 Runtime to client machines and need to check if it is installed already. Your PS script looks like it would work but I cannot use the folder option to check for the software existence. Microsoft recommends checking two registry keys with populated fields for existence or use the GetAvailableCoreWebView2BrowserVersionString API and query the result for the nullprt response in the VersionInfo field. I am a total nubie with any scripting so do you have any examples that would meet this criteria. Any assistance would be much appreciated!

    Reply
    • You can modify the script to check for a registry path. Use test-path to check a path, here is an example.

      test-path ‘HKLM:\software\7-Zip’

      It will return true or false.

      Reply
  2. Good threads!

    Reply
    • Thanks Silas

      Reply

Leave a Comment