mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-04-03 14:06:27 +00:00
23 lines
604 B
PowerShell
23 lines
604 B
PowerShell
|
|
# Read Apps.json and return the list of preset objects (Name + AppIds).
|
||
|
|
# Returns an empty array if the file cannot be read or contains no presets.
|
||
|
|
function LoadAppPresetsFromJson {
|
||
|
|
try {
|
||
|
|
$jsonContent = Get-Content -Path $script:AppsListFilePath -Raw | ConvertFrom-Json
|
||
|
|
}
|
||
|
|
catch {
|
||
|
|
Write-Warning "Failed to read Apps.json: $_"
|
||
|
|
return @()
|
||
|
|
}
|
||
|
|
|
||
|
|
if (-not $jsonContent.Presets) {
|
||
|
|
return @()
|
||
|
|
}
|
||
|
|
|
||
|
|
return @($jsonContent.Presets | ForEach-Object {
|
||
|
|
[PSCustomObject]@{
|
||
|
|
Name = $_.Name
|
||
|
|
AppIds = @($_.AppIds)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|