mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-05 10:02:21 +01:00
Update check-apps.ps1
This commit is contained in:
parent
483351b9db
commit
01e8d59b7e
@ -15,20 +15,18 @@ try {
|
|||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
Write-Progress "⏳ Querying installed applications..."
|
Write-Progress "⏳ Querying installed apps & updates..."
|
||||||
$Apps = Get-AppxPackage
|
$Apps = Get-AppxPackage
|
||||||
$Status = "✅ $($Apps.Count) apps installed"
|
$Status = "✅ $($Apps.Count) apps installed"
|
||||||
|
|
||||||
Write-Progress "⏳ Checking installed applications..."
|
|
||||||
[int]$NumNonOk = 0
|
[int]$NumNonOk = 0
|
||||||
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } }
|
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } }
|
||||||
if ($NumNonOk -gt 0) { $Status += ", $NumNonOk non-ok" }
|
if ($NumNonOk -gt 0) { $Status += ", $NumNonOk non-ok" }
|
||||||
[int]$NumErrors = (Get-AppxLastError)
|
[int]$NumErrors = (Get-AppxLastError)
|
||||||
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
|
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
|
||||||
|
|
||||||
Write-Progress "⏳ Querying application upgrades..."
|
|
||||||
$NumUpdates = (winget upgrade --include-unknown).Count - 5
|
$NumUpdates = (winget upgrade --include-unknown).Count - 5
|
||||||
Write-Progress -Completed "Querying finished."
|
Write-Progress -Completed "."
|
||||||
Write-Host "$Status, $NumUpdates upgrades available"
|
Write-Host "$Status, $NumUpdates upgrades available"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user