We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Chris • 4 years ago

Hi Ruben

Thanks for this guide, which now works fine.
I had to make a few adjustments though.

1. in the DetectionScript I had to add another line: exit $LastExitCode
This was necessary because the 'choco list' triggers an exit code of 2, but the Powershell script does not pass this to Intune and therefore the ExitCode was always 0 in Intune.

2. the method in the DetectionScript via the script name unfortunately does not work for me because the DetectionScript had the ID of the app as name after the installation:
Excerpt from IntuneManagementExtension.log: agentexecutor.exe" -powershellDetection "C:\Program Files (x86)\Microsoft Intune Management Extension\Content\DetectionScripts\2b1e9088-87b0-4139-af3e-34221f7aa00e_1.ps1
So in the DetectionScript I changed to this:
$PackageName = "<packagename>"
(<packagename> is replaced with the ChocoPackageName via Powershell).

@Sascha: The second tipp could also solve your issue as I've had the same problem before.

Ruben ten Hove • 4 years ago

Thanks @disqus_QRxVtPcWMB

this does indeed improve the detection. I've added your adjustments to
the post above. Good work, and glad to see it is helping people :)

Sascha Tobler • 4 years ago

@disqus_QRxVtPcWMB thank you. I will look into this. :)
Update. For a test i did this -> $PackageName="adobereader" (Packagename Hardcoded).
Running it on my maschine got me 1 Package Installed. Uploaded it as Detection Script got me the same errors :( But the Software is installed :)
And another Update:
Now it works! I did the thing with the Exit Codes and the Packagename. But my biggest mistake was the trigger "Enforce script signature check and run script silently" switched this to no and now it works.

Ugo • 2 years ago

Great & clear explanation, very helpfull. Thank you.
Chocolatey changed the choco list command in V2.0.0
"choco list -e $PackageName --local-only"
now needs to be:
"choco list -e $PackageName"
https://docs.chocolatey.org...

Ruben ten Hove • 2 years ago

Glad it's been helpful!
I've updated the page for the new syntax, thanks!

Sascha Tobler • 4 years ago

Hi Ruben,
thank you for the scripts and the explanation. It works really good now. I struggled a bit in the beginning with the detection Script, but rereading your articel and setting enforce signature check solved this problem.
Software like Firefox installs now properly. But in Intune and Toast Notification i get the Message that the Software was not installed properly. Maybe something to do wit the return codes?