2022-10-08 00:18:46 +00:00
|
|
|
function Get-WingetSystemApps {
|
|
|
|
|
2023-03-31 15:56:07 +00:00
|
|
|
#Json File, where to export system installed apps
|
2022-10-08 00:18:46 +00:00
|
|
|
$jsonFile = "$WorkingDir\winget_system_apps.txt"
|
|
|
|
|
|
|
|
#Get list of installed Winget apps to json file
|
|
|
|
& $Winget export -o $jsonFile --accept-source-agreements -s winget | Out-Null
|
|
|
|
|
|
|
|
#Convert json file to txt file with app ids
|
|
|
|
$InstalledApps = get-content $jsonFile | ConvertFrom-Json
|
|
|
|
|
2023-01-16 02:49:24 +00:00
|
|
|
#Save app list
|
2022-10-08 00:18:46 +00:00
|
|
|
Set-Content $InstalledApps.Sources.Packages.PackageIdentifier -Path $jsonFile
|
|
|
|
|
2023-01-16 02:49:24 +00:00
|
|
|
#Sort app list
|
|
|
|
Get-Content $jsonFile | Sort-Object | Set-Content $jsonFile
|
|
|
|
|
2022-10-08 00:18:46 +00:00
|
|
|
}
|