Files
DeployCenter/Modules/Configuration.psm1
benoit 2212e25d31 Ajout de la langue anglaise
Ajout d'un README.md avec le descriptif et les instructions
L'ancien README.md s'appelle désormais CHANGELOG.md
Activation du pavé numérique par défaut pour les installations sans assistance
Nouveau design pour la fenêtre de déploiement.
Ajout de paramètre pour pouvoir procéder à une installation totalement automatisée
Ajout de paramètre pour copier au choix sources, drivers ou les deux sur C:\DeployVenter avant leur usage par DISM.
2026-10-18 04:14:17 +02:00

73 lines
3.3 KiB
PowerShell

# DeployCenter - Read user preferences
# Read-only: this module never modifies DeployCenter.ini.
function Read-DeployCenterConfig {
[CmdletBinding()]
param([Parameter(Mandatory=$true)][string]$ConfigPath)
$config = @{
Theme = 'Light'
SourcePaths = '%DEPLOY_VOLUME%'
VncPassword = ''
WinRESizeMB = 1024
UnattendAdminName = 'admin'
UnattendAdminDisplayName = 'Local Administrator'
UnattendAdminGroup = 'Administrators'
UnattendAdminPasswordBase64 = ''
UnattendSupportProvider = ''
UnattendSupportURL = ''
UnattendSupportAppURL = ''
UnattendWallpaperPath = 'Assets\blorand.png'
DriverRootPath = ''
DriverUrls = @{ Lenovo = ''; Dell = ''; HP = ''; Microsoft = '' }
}
if (-not (Test-Path -LiteralPath $ConfigPath -PathType Leaf)) { return $config }
$section = ''
foreach ($line in (Get-Content -LiteralPath $ConfigPath -ErrorAction SilentlyContinue)) {
$trimmed = $line.Trim()
if (-not $trimmed -or $trimmed.StartsWith(';') -or $trimmed.StartsWith('#')) { continue }
if ($trimmed -match '^\[(.+)\]$') { $section = $matches[1].Trim(); continue }
if ($trimmed -notmatch '^([^=]+)=(.*)$') { continue }
$key = $matches[1].Trim()
$value = $matches[2].Trim()
if ($section -ieq 'General' -and $key -ieq 'Theme' -and $value -match '^[A-Za-z0-9_-]+$') {
$config.Theme = $value
} elseif ($section -ieq 'Sources' -and $key -ieq 'Paths') {
$config.SourcePaths = $value
} elseif ($section -ieq 'UltraVNC' -and $key -ieq 'Password') {
$config.VncPassword = $value
} elseif ($section -ieq 'Partitioning' -and $key -ieq 'WinRESizeMB') {
$sizeMB = 0
if (-not [int]::TryParse($value, [ref]$sizeMB) -or $sizeMB -le 0) {
throw "[Partitioning] WinRESizeMB must be a positive integer. Value received: '$value'."
}
$config.WinRESizeMB = $sizeMB
} elseif ($section -ieq 'Unattend' -and $key -ieq 'AdminName') {
$config.UnattendAdminName = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'AdminDisplayName') {
$config.UnattendAdminDisplayName = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'AdminGroup') {
$config.UnattendAdminGroup = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'AdminPasswordBase64') {
$config.UnattendAdminPasswordBase64 = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'SupportProvider') {
$config.UnattendSupportProvider = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'SupportURL') {
$config.UnattendSupportURL = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'SupportAppURL') {
$config.UnattendSupportAppURL = $value
} elseif ($section -ieq 'Unattend' -and $key -ieq 'WallpaperPath') {
$config.UnattendWallpaperPath = $value
} elseif ($section -ieq 'Drivers' -and $key -ieq 'RootPath') {
$config.DriverRootPath = $value
} elseif ($section -ieq 'Drivers' -and $key -match '^(Lenovo|Dell|HP|Microsoft)URL$') {
$config.DriverUrls[$matches[1]] = $value
}
}
return $config
}
Export-ModuleMember -Function Read-DeployCenterConfig