PowerShell/Scripts/check-apps.ps1

29 lines
690 B
PowerShell
Raw Normal View History

2022-12-02 11:48:59 +01:00
<#
.SYNOPSIS
Query application details
.DESCRIPTION
This PowerShell script queries application details and list it.
2022-12-02 11:48:59 +01:00
.EXAMPLE
PS> ./check-apps
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
if ($IsLinux) {
# TODO
} else {
2022-12-04 19:07:18 +01:00
Write-Progress "⏳ (1/2) Querying installed applications..."
$NumAppsInstalled = (Get-AppxPackage).Count
2022-12-04 19:07:18 +01:00
Write-Progress "⏳ (2/2) Querying available updates..."
$NumUpdates = (winget upgrade).Count - 5
"$NumAppsInstalled apps installed, $NumUpdates updates available"
}
2022-12-02 11:48:59 +01:00
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}