Install Chocolatey With Microsoft Intune

In this Microsoft Intune article, We will show how to install Chocolatey on Windows 11-managed machines using Intune.

Chocolatey is a package manager software for Windows that automate the installation of software using the command line without any user interaction.

To deploy it, we will need to use the Win32 content prep tool and create an installer that we will push to our managed machines.

Install Win32 Content Prep Tool

To use the Win32 tool, Download it from the following link and install it.

https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/releases

Create a Directory on your local machine

Mkdir Chocolatey

Create PowerShell Script

Chocolatey installation is made from a PowerShell script. Create a PowerShell script with the following name and place it in the folder you created in the previous step.

InstallChoco.ps1

The script:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Folder Structure

Your folder structure should look as follows:

After you place all the files in the folder, open a command line and run

PS C:\intuneApps\Chocolatey> .\IntuneWinAppUtil.exe
Please specify the source folder: c:\intuneapps\chocolatey
Please specify the setup file: installchoco.ps1

Please specify the output folder: IntuneWin

Do you want to specify catalog folder (Y/N)?n

The above command should produce the .intunewin file, as shown below.

Deploy App

To deploy the app to the computer, add a Windows app (Win32)

Upload the file

Fill in the details as shown below

Use the following values:

Install command

powershell.exe -executionpolicy bypass .\InstallChoco.ps1

Uninstall Command

powershell.exe -executionpolicy bypass .\UnInstallChoco.ps1

In the detection rule us:

Path = C:\ProgramData\
File or folder = Chocolatey
Detection method = File or folder exist

Finish the wizard and assign the policy to computers.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.