private/Step-BuildBootSetDismSettings.ps1
|
#Requires -PSEdition Core function Step-BuildBootSetDismSettings { <# .SYNOPSIS Sets servicing locale and time zone values in the mounted WinPE image .DESCRIPTION Uses dism.exe to set global BuildMedia.SetTimeZone and then query the current international configuration. When configured, it also applies BuildMedia.SetAllIntl and BuildMedia.SetInputLocale. Each operation writes a timestamped DISM log under global BuildMedia.LogsPath. The time zone command is always invoked, including when SetTimeZone is empty. The international and input locale commands are conditional on nonempty values. .EXAMPLE PS> Step-BuildBootSetDismSettings Applies the current build's time zone and optional locale settings. .INPUTS None. This function does not accept pipeline input. .OUTPUTS System.String. Passes through any native stdout emitted by dism.exe; quiet mode normally suppresses it. .NOTES Author: David Segura Company: Recast Software Version: 0.1.0 Date: 2026-08-28 Requires global BuildMedia with MountPath, LogsPath, SetTimeZone, SetAllIntl, and SetInputLocale properties and dism.exe. Modifies mounted-image servicing settings and creates log files. #> [CmdletBinding()] param () $MountPath = $global:BuildMedia.MountPath $LogsPath = $global:BuildMedia.LogsPath $SetTimeZone = $global:BuildMedia.SetTimeZone $SetAllIntl = $global:BuildMedia.SetAllIntl $SetInputLocale = $global:BuildMedia.SetInputLocale Write-Verbose "[$($MyInvocation.MyCommand.Name)] MountPath: $MountPath" Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Set-TimeZone to $SetTimeZone" $CurrentLog = "$LogsPath\$((Get-Date).ToString('yyMMdd-HHmmss'))-Set-TimeZone.log" dism.exe /quiet /image:"$MountPath" /Set-TimeZone:"$SetTimeZone" /LogPath:"$CurrentLog" Write-HostDateTimeDarkGray 'Log current Get-Intl configuration' $CurrentLog = "$LogsPath\$((Get-Date).ToString('yyMMdd-HHmmss'))-Get-Intl.log" dism.exe /quiet /image:"$MountPath" /Get-Intl /LogPath:"$CurrentLog" if ($SetAllIntl) { Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Set-AllIntl to $SetAllIntl" $CurrentLog = "$LogsPath\$((Get-Date).ToString('yyMMdd-HHmmss'))-Set-AllIntl.log" dism.exe /quiet /image:"$MountPath" /Set-AllIntl:$SetAllIntl /LogPath:"$CurrentLog" } if ($SetInputLocale) { Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Set-InputLocale to $SetInputLocale" $CurrentLog = "$LogsPath\$((Get-Date).ToString('yyMMdd-HHmmss'))-Set-InputLocale.log" dism.exe /quiet /image:"$MountPath" /Set-InputLocale:$SetInputLocale /LogPath:"$CurrentLog" } } |