Update check-apps.ps1 and check-software.ps1

This commit is contained in:
Markus Fleschutz 2023-08-12 09:13:17 +02:00
parent f73f8b3ccb
commit f6da1a39f7
2 changed files with 9 additions and 8 deletions

View File

@ -2,10 +2,10 @@
.SYNOPSIS .SYNOPSIS
Query the app status Query the app status
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the application status and prints it. This PowerShell script queries the installed applications and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-apps.ps1 PS> ./check-apps.ps1
119 apps installed, 11 upgrades available 119 Windows apps installed, 11 upgrades available
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -17,9 +17,10 @@ try {
$NumSnaps = (snap list).Count - 1 $NumSnaps = (snap list).Count - 1
Write-Host "$($NumSnaps) snaps installed" Write-Host "$($NumSnaps) snaps installed"
} else { } else {
Write-Progress "⏳ Querying installed apps and updates..." Write-Progress "⏳ Querying installed applications..."
$Apps = Get-AppxPackage $Apps = Get-AppxPackage
$Status = "$($Apps.Count) apps installed" Write-Progress -Completed "."
Write-Host "$($Apps.Count) Windows apps installed, " -noNewline
[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++ } }
@ -28,8 +29,7 @@ try {
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" } if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
$NumUpdates = (winget upgrade --include-unknown).Count - 5 $NumUpdates = (winget upgrade --include-unknown).Count - 5
Write-Progress -Completed "." Write-Host "$NumUpdates upgrades available"
Write-Host "$Status, $NumUpdates upgrades available"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -7,7 +7,8 @@
PS> ./check-software.ps1 PS> ./check-software.ps1
S O F T W A R E S O F T W A R E
BIOS 'P62 v02.67', release HPQOEM - 0, S/N CZC448B9C1 by HP BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -19,8 +20,8 @@
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E" & "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
& "$PSScriptRoot/check-bios.ps1" & "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-os.ps1" & "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-powershell.ps1"
& "$PSScriptRoot/check-apps.ps1" & "$PSScriptRoot/check-apps.ps1"
& "$PSScriptRoot/check-powershell.ps1"
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-time-zone.ps1" & "$PSScriptRoot/check-time-zone.ps1"
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"