wingetautoupdate/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1

18 lines
729 B
PowerShell
Raw Permalink Normal View History

2023-09-15 14:38:54 +00:00
function Get-WingetSystemApps
{
# Json File, where to export system installed apps
$jsonFile = ('{0}\winget_system_apps.txt' -f $WorkingDir)
# Get list of installed Winget apps to json file
$null = (& $Winget export -o $jsonFile --accept-source-agreements -s winget)
# Convert json file to txt file with app ids
$InstalledApps = (Get-Content -Path $jsonFile | ConvertFrom-Json)
# Save app list
$null = (Set-Content -Value $InstalledApps.Sources.Packages.PackageIdentifier -Path $jsonFile -Force -Confirm:$False -ErrorAction SilentlyContinue)
# Sort app list
$null = (Get-Content -Path $jsonFile | Sort-Object | Set-Content -Path $jsonFile -Force -Confirm:$False -ErrorAction SilentlyContinue)
}