With this script you automate the APP-Deployment. You can publish Chocolatey APPs with intune and keep them up2date. The Script automaticly creates the application, and installs automaticly the required chocolatey application. It also downloads the Application-Icons from Chocolatey to make it watching nice in the Customer Portal, if you dont want to install it automaticly The Application is published automaticly for every user. You can also make it be installed automaticly
For keeping the installed software updated, the Installer creates a Scheduled Task for every application with fires a "choco upgrade -y" on every startup for every deployed application
Special thanks to Brad Wyatt who gave me the the incentive to that automation https://www.thelazyadministrator.com/2020/02/05/intune-chocolatey-a-match-made-in-heaven/
- Start powershell with elevated rights.
- Download The Script and Save it for example to C:\admin
- Install and Import all required Modules, chocolatey and Software for icon-converting.
set-executionpolicy unrestricted # not needed but my one is set so, you can try it with other policies
Install-Module IntuneWin32App -Force
Import-Module IntuneWin32App
Install-Module Microsoft.Graph.Intune -Force
Import-Module Microsoft.Graph.Intune
Install-Module -Name chocolatey
Import-Module -Name chocolatey
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'))
choco install inkscape -y
- OPTIONAL IF YOU USE IT MANUALLY Connect to Intune Graph API (Multi-Tenant Use is possible)
Connect-MSIntuneGraph -TenantID "contoso.com"
- OPTIONAL IF YOU USE IT MANUALLY Import Downloaded Script (in this sample from C:\admin)
import-module "C:\admin\ChocoIntuneDeployment-Main.ps1"
in simplest way, easy run the script.
First you will be asked, what tenant you want to connect and you will be asked for M365 Creds to authenticate to Graph API
Then you can choose the software you want to install. (Hold STRG to select more then One)
Start the Process With OK
Everything else is done automaticly now
You can easy add software you like to the list. You need to find following line and add Software in following pattern
"<Description>","<choconame>"
$Content = '
<ADD YOUR CONTENT HERE>
"Adobe Acrobat Reader DC","adobereader"
"Google Chrome","googlechrome"
"Mozilla Firefox","firefox"
"Java SE Runtime Environment","jre8"
.
.
.
This step is only required, if you want to install it manually or the automatic process is not working. Normaly, chocolaty will be installed automaticly befor you publish the first application
install-chocolatey
Installing a new Application is done simply by running the main function
New-IntuneWin32ChocoApplication
You will be prompted to enter a pattern of what Software you want to install. After that select the wanted software.
By default the Software is published but not autoinstalled for every user in the intune Tenant. To make it automaticly installed add the Switch -Required
New-IntuneWin32ChocoApplication -Required
If you know the exact chocolatey name, you can also deploy the software without any userpromt
New-IntuneWin32ChocoApplication "googlechrome"
New created Windows applications
Configured chocolatey Application with detection Rule
Deployed application with detection script, dependency to the choco application and available for all users
Result shown in Company Portal:
Configured Update Task in Task Scheduler