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