-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetect-WinGetUpdates.ps1
More file actions
32 lines (28 loc) · 982 Bytes
/
Copy pathDetect-WinGetUpdates.ps1
File metadata and controls
32 lines (28 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# List of application IDs to check for updates
$apps = @(
"Google.Chrome",
"Mozilla.Firefox",
"VideoLAN.VLC",
"Adobe.Acrobat.Reader.64-bit"
)
# Initialize an array to store outdated apps
$outdatedApps = @()
# Get the list of applications with upgrades available
$upgradeList = winget list --upgrade-available
# Loop through each app and check if it's listed for upgrade
foreach ($app in $apps) {
if ($upgradeList -match $app) {
Write-Host "$app needs an update"
$outdatedApps += $app
} else {
Write-Host "$app is up-to-date"
}
}
# Output result for Intune detection
if ($outdatedApps.Count -gt 0) {
Write-Host "Outdated applications detected: $($outdatedApps -join ', ')"
exit 1 # Exit with 1 if outdated apps are found (indicating non-compliance)
} else {
Write-Host "All applications are up-to-date"
exit 0 # Exit with 0 if all apps are up-to-date (indicating compliance)
}