cloudfil.ch Cloud - First in Line

Copy Program Folder to all devices using Microsoft Intune

Introduction

Organizations are incorporating new technologies to improve productivity in today’s world of digital transformation. One such innovation is Microsoft’s cloud-based Intune solution for managing PCs and mobile devices. Using a single console, Intune enables IT administrators to manage and secure devices, apps, and data. In this article, we’ll go over how to use Intune Win32 app deployment to deploy a solution to copy a program folder to all devices.

Why Deploying a Program Folder is Important?

Some small applications do not offer an easy way to package them. Therefore, the IT administrator has to think of other ways to make the application available to the users.

One way would be (if the app works like this) to copy the application folder to all devices and create the necessary customizations like the desktop icon via PowerShell script. It is important to note that this does not contradict the manufacturer’s policy, and no license conflicts arise.

PowerShell Script

For this reason I have developed the following script for a few smaller education applications. I am not the best PowerShell coder, but it works 🙂

The script copies the packaged program folder to “C:\Program Files (x86)\” and also creates the shortcuts in the Start menu and Public Desktop.

[CmdletBinding()]
Param (
   
   [Parameter(Mandatory=$false)]
   [String]$Source="Sourcefolder",
   
   [Parameter(Mandatory=$false)]
   [String]$Link="Software.lnk",
   
   [Parameter(Mandatory=$false)]
   [String]$SourcePath="C:\Program Files (x86)\",

   [Parameter(Mandatory=$false)]
   [Switch]$Remove=$false
)

$PSDefaultParameterValues['*:Encoding'] = 'utf8'

Start-Transcript -Path $(Join-Path $env:windir "InstallApp.log")

try{
If ($Remove.IsPresent -eq $false){
            
    New-Item -Path "${env:ProgramFiles(x86)}\$Source" -ItemType Directory -Force
    Copy-Item -Path ".\$Source" -Destination "${env:ProgramFiles(x86)}\" -Force -Recurse
    Copy-Item -Path "${env:ProgramFiles(x86)}\$Source\$Link" -Destination "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs" -Force
    Copy-Item -Path "${env:ProgramFiles(x86)}\$Source\$Link" -Destination "C:\Users\Public\Desktop" -Force

}else {

    Remove-Item -Path "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\$Link" -Force -Recurse 
    Remove-Item -Path "C:\Users\Public\Desktop\$Link" -Force
    Remove-Item -Path "${env:ProgramFiles(x86)}\$Source" -Force -Recurse 
    
}
}catch{
    Write-Error $_
}


Stop-Transcript

Application Preparation Guide

The following components and applications would be needed for this:

  1. Program Folder
  2. PS2EXE-GUI
  3. IntuneWinAppUtil
  4. Copy_ProgramFolder PowerShell Script (above)

Prepare the Program Folder

To be able to package the application, the basic structure of the application must be understood to some extent. It needs an application exe and certainly a shortcut, also the program folder should not be too big. Here is an example using the SNG Tool App:

The link must have the following content (target), otherwise the link will not work later.

"C:\Program Files (x86)\SNG_Tool\SNG Tool.exe"

Prepare the PowerShell Script

In my testing, it often made sense to convert the PowerShell file to an .exe file. This can be crucial during the installation afterwards on the devices (context). To make this easy we use the application Win-PS2EXE.

Create the .intunewin File

Finally, the .intunewin file is created and then the deployment can be started via Intune Admin Dashboard.

Preperation Overview

In summary, the preparation must be approximately as follows.

How to Deploy via Intune Win32 App

A new Win32 app can now be added in the Intune Admin Dashboard under Apps.

The installation commands look like this and have to be adapted depending on the application, of course. Here is the example with SNG Tool. With the Uninstall Command it is clear to see that it needs the parameter Remove.

Copy_ProgramFolder.exe -Source "SNG_Tool" -Link "SNG Tool.lnk"
Copy_ProgramFolder.exe -Source "SNG_Tool" -Link "SNG Tool.lnk" -Remove

The detection rule can be structured as follows and extended as required.

The assignment of the application can be made to users as well as to device groups.

Conclusion

Intune Win32 app deployment of a program folder to all devices is a crucial task for many organizations, to sum up. While standardizing software installations across all devices, it makes sure that every device has the files and configurations required to run the program properly. IT managers can quickly deploy a program folder using Intune to all devices by following the instructions in this article, which will also cut down on time and the possibility of incompatibility problems.

Recent Posts

Nico Wyss

Writer & Blogger

Be the First in Line!

Sign up for a Newsletter.

You have been successfully Subscribed! Ops! Something went wrong, please try again.

© 2023 Copyright