Your Intune environment is almost ready! One of the last step of this series is app packaging. Which app types exist? How can I start with the process of packaging an application and which tools are needed? Explore the world of packaging in this post. No worries, it’s not that complicated.
App Types
Microsoft Store App
Every Microsoft Store App can be deployed with Microsoft Intune. There is one (big) exception: paid apps are not supported. To deploy the app of your choice start here. This method is based on Winget.
What’s Winget?
Winget is a package manager for Windows, developed by Microsoft, designed to streamline the installation, upgrade, and configuration of software on Windows operating systems. It allows users to automate the process of managing software applications through a command-line interface, offering commands to search, install, update, and remove software packages. Winget works by accessing a repository of software packages, where it fetches the latest versions of applications and handles the installation process seamlessly.
Example
Click on “Add” and select “Microsoft Store App (New)” and click on “Select”
Search for your App and select it.
Ensure that all the necessary informations are filled in and assign the app to a group.
Microsoft 365 Apps
To deploy your M365 Apps of choice doesn’t need much effort. Microsoft is providing you a GUI (graphical user interface) to select the apps you want to deploy, including update channel and some basic settings. You could also configure everything with your existing .xml file from office configurator.
Example
Click on “Add” and “Microsoft 365 Apps for Windows 10 and later” and click on “Select”
Fill in all the package informations and select the main apps you want to include in your office package.
Select the additional apps you want to include.
Configure all the settings according to your preferences. Once completed, assign the package to a group.
Microsoft Edge
With this app template Microsoft makes it easy for you to deploy Microsoft Edge.
Example
Click on “Add” and “Microsoft Edge for Windows 10 and later” and click on “Select”
Now you just have to select your preferred update-channel and language and that’s it.
Web Application / (Windows) Web link
If you want to deploy a webapp of your choice, then this is the right template for you. Every url / webapp you deploy like that will automatically get added to your start menu. There is another similar option called weblink, but that will only open a webbrowser.
Example
Click on “Add” and “Windows web link” and click on “Select”
Fill in all the necessary properties and decide if you want the webapp to be opened in a managed browser or not. After the assignment to a group your webapp is ready to get deployed.
Line-of-business app
Like this you can upload different filetypes like .msi, .appx, .appxbundle, .msix, and .msixbundle. It’s the easiest way to deploy a “normal” Windows application. With some 3rd party tools you could even customize these files and add configurations or special steps during installation to them.
Example
Click on “Add” and “Line-of-business app” and click on “Select”.
Now upload your file and add install / uninstall-string and properties. If you need to update your app, just upload the new file.
Windows app (Win32)
Last but not least, the most exciting option. Your custom packages, your Win32-Apps. They have to be packaged in .intunewin format. To convert your app you can use the tool provided by Microsoft. It’s pretty easy, and in the next chapter I’ll show you how.
How to package for Microsoft Intune
The “Easy-Way”
Prerequisites
- Download the Microsoft Win32 Content Prep Tool from Github
- Create a Folder “Source” for example on your Desktop
- Copy the extracted IntuneWinAppUtil.exe in “Source” folder
- Copy the following script “createpackage.ps1” into “Source” folder
# Define the source folder and the final folder
$sourceFolder = ".\"
$finalFolder = ".\Final"
# Ensure the final folder exists
if (-not (Test-Path -Path $finalFolder)) {
New-Item -ItemType Directory -Path $finalFolder
}
# Find the .exe file in the source folder, excluding IntuneWinAppUtil.exe
$exeFile = Get-ChildItem -Path $sourceFolder -Filter "*.exe" | Where-Object { $_.Name -ne "IntuneWinAppUtil.exe" } | Select-Object -First 1
if ($null -eq $exeFile) {
Write-Error "No executable file found in the source folder."
exit
}
# The path to the IntuneWinAppUtil.exe tool
$intuneWinAppUtilPath = ".\IntuneWinAppUtil.exe"
# Generate the .intunewin file
& $intuneWinAppUtilPath -c $sourceFolder -s $exeFile.Name -o $finalFolder
if ($?) {
Write-Host "Package creation successful."
# Assuming there's only one .intunewin file, rename it to match the .exe file's name
$intunewinFile = Get-ChildItem -Path $finalFolder -Filter "*.intunewin" | Select-Object -First 1
if ($null -ne $intunewinFile) {
# Construct the new file name with the .intunewin extension
$newFileName = $exeFile.BaseName + ".intunewin"
$newFilePath = Join-Path -Path $finalFolder -ChildPath $newFileName
# Perform the rename operation
Rename-Item -Path $intunewinFile.FullName -NewName $newFileName
Write-Host "Package renamed to match the .exe file."
}
else {
Write-Host "No .intunewin file found to rename."
}
}
else {
Write-Error "Package creation failed."
}
Packaging
The easy-way is to copy the .exe file of the app in to the source folder. Now you execute the script “createpackage.ps1” and your .intunewin file is ready to go. It will be in the “final” folder and it has the same name as your .exe file.
Upload
This file we have to upload to Microsoft Intune now.
Now you have to add all the properties and install / uninstall parameters of your app. In this example we do it for 7zip.
Important
You have to use silent install parameters.
Tipp
A very good website to get almost every silent install parameter is silentinstallhq.
After doing that, you have to set a detection rule. Normaly I point it to the installed exe-file (or similar) and I include the version of the exe. You could also use a custom detection script, msi-code or registry key instead.
Then just assign the app to a group or all devices / users and you are ready to go.
App Deploy Toolkit
Let’s get a little bit more advanced, shall we? With App Deploy Toolkit (PSADT) it’s possible to create even better packages, more customizable with all your settings, your order of installing certain components, and much more. Even a GUI for your users is included if needed!
So let’s get started.
Prerequisites
- Download or clone PSADT from Github
- Copy the extracted files to “Source” folder created earlier
- Delete everything except of the following things
- Folder “Toolkit”
- Create_package.ps1 script
- IntuneWinAppUtil.exe
- Copy the content of “Toolkit” Folder to root folder
- Create 2 Folders “Files” and “SupportFiles”
Your folder should look like this now.
Packaging
Now we copy the .exe file of our application into the “Files” folder. Then we open “Deploy-Application.ps1”
I recommend to open it in Visual Studio Code.
Go to line 110 – 118 and fill in the needed information about your software.
Now we switch to line 185 and replace “iexplore” with the process-name of our application. You don’t have to add .exe at the end.
We do that for every “Show-InstallationWelcome” line, just search for them. There are 3 in the script.
Now we go to line 209 and add the following commands:
# #MSI Install
# Execute-MSI -Action Install -Path "$dirFiles\name.msi" -Parameters '/quiet'
# #EXE Install
# Execute-Process -Path "$dirFiles\name.exe" -Parameters ""
If you want to perform an .msi installation remove the “#” in the 2nd line, if you have to install an .exe app remove “#” in the 4th line. Then add the necessary parameters like this:
#EXE Install
Execute-Process -Path "$dirFiles\7z2401-x64.exe" -Parameters "/S"
Now the “install” part is done, to continue we have to configure how the app should be uninstalled. To do that, we scroll down until we see this part:
Don’t forget to replace “iexplore” with your process name (number 1 on the screenshot). Now you insert your silent uninstall command into the uninstallation-section (number 2 on the screenshot) For example:
Execute-Process -Path "%ProgramFiles%\7-Zip\Uninstall.exe" -Parameters "/S" -IgnoreExitCodes '*'
Now your script is ready. Save and close it. Execute “Create_package.ps1” and you have your “Deploy-Application.intunewin” file in “Final” folder.
The last step is to upload it to Microsoft Intune and add all the necessary parameters. One of the benefits of PSADT is that you can use the same install and uninstall parameter for every package in Intune, because you define the “real” parameters in the deploy-application” script. So insert the following:
Install:
Deploy-Application.exe Install Silent
Uninstall:
Deploy-Application.exe UnInstall Silent
Tipp
More build-in commands and the full wiki on the website of PSAppDeployToolkit.
After that you define the detection rule just like in the previous chapter, assign the app to a group and then the app gets deployed to your Microsoft Intune devices.
Not that difficult right?
That’s it
Now you have an enrollment strategy and configuration, you know how to create configuration profiles and compliance policies and how to deploy applications. But what about Windows updates? More on that in the next post. So stay tuned!