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