Intune: Scripts and Remediations - Update software
Ref:
[Winget Updates | Proactive Remediations](https://scloud.work/winget-updates-proactive-remediations-2/) |
Task 1 Find the list id of the application
- cmd: winget list List Command:
1
winget list -?
- use the https://winget.run
- enter the application name
1
2
3
winget install -e --id Zoom.Zoom
winget list -e --id Zoom.Zoom --accept-source-agreements
Task2 Powershell - Detection and Remediation Script
Test
1
2
check locally installed Zoom
$localInstalled_software = winget.exe list -e --id Zoom.Zoom --accept-source-agreements
Logic
- If result contain Avaliable, the application needs to upgrade the version
- If result only contain Version, the application is the latest version
- If result don’t show anything, the application is not installed
1
2
3
-3 : line of the header
-2 : "Available" header
1
2
$available= (-split $localInstalled_software[-3])[-2]
Write-Host $available
Result
1
2
3
Name Id Version Available Source
----------------------------------------------
Zoom Zoom.Zoom < 5.12.8964 5.17.7.31859 winget
- remediation scripts will run with exit 1 from detection script
- As Intune is run the script as System.
- use PsExec64.exe -i -s cmd.exe
- Intune>Devices>Windows>Scripts and remediations location
- The script needs to save as UTF-8 format
- Create the script below.
This post is licensed under CC BY 4.0 by the author.