mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-04-03 14:06:27 +00:00
20 lines
422 B
PowerShell
20 lines
422 B
PowerShell
|
|
# Saves configuration JSON to a file.
|
||
|
|
# Returns $true on success, $false on failure.
|
||
|
|
function SaveToFile {
|
||
|
|
param (
|
||
|
|
[Parameter(Mandatory=$true)]
|
||
|
|
[hashtable]$Config,
|
||
|
|
|
||
|
|
[Parameter(Mandatory=$true)]
|
||
|
|
[string]$FilePath
|
||
|
|
)
|
||
|
|
|
||
|
|
try {
|
||
|
|
$Config | ConvertTo-Json -Depth 10 | Set-Content -Path $FilePath -Encoding UTF8
|
||
|
|
return $true
|
||
|
|
}
|
||
|
|
catch {
|
||
|
|
return $false
|
||
|
|
}
|
||
|
|
}
|