scloud by Florian Salzmann
ende

chocolatey - basic installation with Intune

  • Florian Salzmann
  • Posted on 14 Aug, 2021
  • Updated on 26 Aug, 2023
  • 02 Mins read
  • Microsoft Intune

In order to install programs via Chocolatey in Intune, Chocolatey itself must be installed as a basis.
I have summarized how it works and what Chocolatey is here.

_This post is the first part of a series on managing Chocolatey applications via Intune.
_Here I show you how to do the basic installation of Chocolatey with Intune and a Win32 app.

Part 1: This post.
Part 2: chocolatey - Programm Installation - Intune | scloud
Part 3: chocolatey - Programme up to date halten - Intune | scloud

What is chocolatey?

Chocolatey is a huge package repository with installation packages for Windows. The packages are community maintained, but always go through a strict review process before they are released.

More information: Chocolatey Software Docs | Moderation

How does chocolatey work?

Chocolatey can easily be installed via PowerShell. Once the base is present on a device, applications can be installed with the command “choco install application” installed, or with “choco upgrade application” to be updated.

Distribute Chocolatey as a win32 app

Chocolatey can be installed via PowerShell (Admin) with a one-liner:

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'))

In order to improve the distribution via Endpoint Manager and to set some settings, I have expanded the line a little:

$PackageName = "chocolatey"
$Path_local = "$Env:Programfiles\_MEM"
Start-Transcript -Path "$Path_local\Log\$ProgramName-install.log" -Force

try{
    if(!(test-path "C:\ProgramData\chocolatey\choco.exe")){
        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'))
    }
    C:\ProgramData\chocolatey\choco.exe list -lo
    choco feature enable -n=useRememberedArgumentsForUpgrades
    exit 0
}catch{exit 1618}

Stop-Transcript

The whole package including the detection rule can be found here: scloud / chocolatey / chocolatey at main FlorianSLZ / scloud (github.com)

The following parameters are set for distribution:

SettingsWert
Win32 Fileinstall.intunewin
Install command%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\install.ps1
Uninstall commandno uninstall
Requirements64 bit
Detection rulecustom script, check.ps1
Dependenciesnone

If you want to change something in the installation routine, you can simply adapt the “install.ps1” file and generate a new intunewin.

Here are instructions for generating Win32 applications: Create Win32 App / .intunewin | scloud

Related posts

Endpoint Privilege Management vs the Alternatives
Microsoft Intune

When Intune Endpoint Privilege Management Wins, and When It Does Not

You already run standard users. The hard part is the last exceptions. Here is how Intune Endpoint Privilege Management compares to the alternatives.

DNS Suffixes set via Intune
Microsoft Intune

Set DNS Suffixes via Microsoft Intune

Learn how to configure DNS suffixes via Microsoft Intune with a Settings Catalog profile, deploy them safely, and verify the setup on managed Windows devices.

Intune win32 app testing
Microsoft Intune

How I Create and Test Win32 Apps for Intune

How I create and test Win32 apps for Intune: templates, Sandbox and VM testing, checking detection rules locally, and running processes as System.