In the last post (chocolatey - basic installation | scloud) I wrote about how we install Chocolatey and thus ensure the basis for installing applications via Chocolatey. For the distribution of the applications via Chocolatey, I also create a Win32 package that I then distribute with Intune. In this way, it can be tracked which application was installed where and when. You can also uninstall them individually.
Für sämtliche Pakete kann hierzu dieselbe Basis verwendet werden. Die Vorlage ist hier zu finden:
This post is the second part of a series on managing Chocolatey applications via Intune.
Part 1: chocolatey - basic installation with Intune | scloud
Part 2: This Post.
Part 3: chocolatey - keeping programs up to date - Intune | scloud
Table of Contents
Chocolatey Win32
The package, which you can convert into a Win32 or Intunewin file, consists of the following files:
File | Description |
---|---|
install.ps1 | Installation file, which reads the package to be installed from the "choco.txt" file and, if available, also appends the installation parameters from "parameter.txt". In addition, a log is written locally under "C:\Program Files\MEM\EndpointManager". |
choco.txt | Program name according to: Chocolatey Software | Packages |
parameter.txt | If necessary or desired parameters according to the Chocolatey Package documentation. By the way, most programs don't need any parameters. In this case, you can also simply delete the content. |
check.ps1 | Recognition rule for program |
uninstall.ps1 | Uninstalls the program and removes it from the local Chocolatey catalog. |
If a new program is now required, you must enter this in the "choco.txt" and the "check.ps1" file (optionally also in parameter.txt).
Once the intunewin package has been created (Prepare a Win32 app to be uploaded to Microsoft Intune | Microsoft Docs), this can be uploaded and distributed.
Here is a general guide for packaging from me: Create Win32 App / .intunewin | scloud
The parameters for this are:
Settings | value |
---|---|
Win32 File | install.intunewin |
Name | depending on the application |
editor | Maintainer of the environment, eg scloud |
logo | Not mandatory, but nice when the company portal is used. |
Install command | %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\install.ps1 |
Uninstall command | %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\uninstall.ps1 |
Requirements | 64 bit |
Detection rule | custom script, check.ps1 |
Dependencies | chocolatey |
You installed a program with Intune (Win32) and Chocolatey that easily. In order to be able to guarantee the updates of the programs, I have prepared the following article for you:
Troubleshoot Chocolatey Installation
To troubleshoot the installation, each installation and uninstallation creates a log. These are each in the path "C:\Program Files\MEM\EndpointManager\Log" filed.
The log contains the complete transcript of the installation. Here is an example of the Snagit installation with the installation message from Chocolatey:
Hey Florian - love your guides, but I wanted to point out a mistake that is in the package parameters. In line 8 & 10 of the install.ps1 script you just have the variable '$InstallParameter' at the end of the upgrade/install commands. However, that's incorrect - you need to do '--package-parameters="$InstallParameter"'.
While I agree that package parameters are rare, they are sometimes needed in Chocolatey - and the way you have your script setup it will not work.
Thanks!
Hi Scott, thanks for your input.
The reason why i chose the variable without the
--package-paramters
part, was because i found some applications where instead of that it was--params='"/licensekey=ABCD-EFGH-IJKL"'