Kaffeeundcode
Script Library
PowerShell 01.06.2026

Script Workspace

Remediate UpdateApp

Review the purpose, inspect the code, then test it safely in your own tenant.

052_Remediate-UpdateApp.ps1

<#
.SYNOPSIS
    Platzhalter für einen App-Update Trigger.
    (Intune Remediation Script)

.DESCRIPTION
    Da Updates app-spezifisch sind (MSI exec, Winget, Chocolatey), dient dieses Skript als Template.
    Beispiel: Nutzung von Winget zum Upgrade.

    Parameter:
    - AppId: Winget ID (z.B. Google.Chrome)

.NOTES
    File Name: 052_Remediate-UpdateApp.ps1
    Author: Mattia Cirillo
    Version: 1.0
#>

param (
    [Parameter(Mandatory=$true)] [string]$AppId
)

try {
    Write-Host "Versuche Update für '$AppId' via Winget..."
    
    # Hinweis: Winget benötigt System-Kontext Handling (oft tricky).
    # Hier als generischer Aufruf:
    
    winget upgrade --id $AppId --accept-package-agreements --accept-source-agreements --silent
    
    if ($LASTEXITCODE -eq 0) {
        Write-Host "Update erfolgreich angestoßen."
    } else {
        throw "Winget Exit Code: $LASTEXITCODE"
    }

} catch {
    Write-Error "Fehler: $_"
    exit 1
}