Fixed issues

- Fixed an issue where if AppsScriptVariables was configured in a config file, the hashtable wasn't being created by the script when setting the variable.
- Fixed a crash where shortening the Windows SKU was creating duplicate shortened names for certain SKUs.
This commit is contained in:
rbalsleyMSFT
2025-01-16 18:00:08 -08:00
parent 227fb4fa94
commit 7c9f24f695
2 changed files with 18 additions and 20 deletions
+17 -19
View File
@@ -384,12 +384,12 @@ if ($ConfigFile -and (Test-Path -Path $ConfigFile)) {
} }
# If this is the Headers parameter, convert PSCustomObject to hashtable # If this is the Headers parameter, convert PSCustomObject to hashtable
if ($key -eq 'Headers' -and $value -is [System.Management.Automation.PSCustomObject]) { if ((($key -eq 'Headers') -or ($key -eq 'AppsScriptVariables')) -and ($value -is [System.Management.Automation.PSCustomObject])) {
$headers = [hashtable]::new() $hashtableValue = [hashtable]::new()
foreach ($prop in $value.psobject.Properties) { foreach ($prop in $value.psobject.Properties) {
$headers[$prop.Name] = $prop.Value $hashtableValue[$prop.Name] = $prop.Value
} }
$value = $headers $value = $hashtableValue
} }
# Check if this key matches a parameter in the script # Check if this key matches a parameter in the script
@@ -3135,36 +3135,34 @@ function Get-ShortenedWindowsSKU {
) )
$shortenedWindowsSKU = switch ($WindowsSKU) { $shortenedWindowsSKU = switch ($WindowsSKU) {
'Core' { 'Home' } 'Core' { 'Home' }
'CoreN' { 'Home_N' }
'CoreSingleLanguage' { 'Home_SL' }
'Education' { 'Edu' }
'EducationN' { 'Edu_N' }
'Professional' { 'Pro' }
'ProfessionalN' { 'Pro_N' }
'ProfessionalEducation' { 'Pro_Edu' }
'ProfessionalEducationN' { 'Pro_Edu_N' }
'ProfessionalWorkstation' { 'Pro_WKS' }
'ProfessionalWorkstationN' { 'Pro_WKS_N' }
'Enterprise' { 'Ent' }
'EnterpriseN' { 'Ent_N' }
'ServerStandard' { 'Srv_Std' }
'ServerDatacenter' { 'Srv_Dtc' }
'Home' { 'Home' } 'Home' { 'Home' }
'CoreN' { 'Home_N' }
'Home N' { 'Home_N' } 'Home N' { 'Home_N' }
'CoreSingleLanguage' { 'Home_SL' }
'Home Single Language' { 'Home_SL' } 'Home Single Language' { 'Home_SL' }
'Education' { 'Edu' } 'Education' { 'Edu' }
'EducationN' { 'Edu_N' }
'Education N' { 'Edu_N' } 'Education N' { 'Edu_N' }
'Professional' { 'Pro' } 'Professional' { 'Pro' }
'Pro' { 'Pro' }
'ProfessionalN' { 'Pro_N' }
'Pro N' { 'Pro_N' } 'Pro N' { 'Pro_N' }
'ProfessionalEducation' { 'Pro_Edu' }
'Pro Education' { 'Pro_Edu' } 'Pro Education' { 'Pro_Edu' }
'ProfessionalEducationN' { 'Pro_Edu_N' }
'Pro Education N' { 'Pro_Edu_N' } 'Pro Education N' { 'Pro_Edu_N' }
'ProfessionalWorkstation' { 'Pro_WKS' }
'Pro for Workstations' { 'Pro_WKS' } 'Pro for Workstations' { 'Pro_WKS' }
'ProfessionalWorkstationN' { 'Pro_WKS_N' }
'Pro N for Workstations' { 'Pro_WKS_N' } 'Pro N for Workstations' { 'Pro_WKS_N' }
'Enterprise' { 'Ent' } 'Enterprise' { 'Ent' }
'EnterpriseN' { 'Ent_N' }
'Enterprise N' { 'Ent_N' } 'Enterprise N' { 'Ent_N' }
'ServerStandard' { 'Srv_Std' }
'Standard' { 'Srv_Std' } 'Standard' { 'Srv_Std' }
'Standard (Desktop Experience)' { 'Srv_Std_DE' } 'ServerDatacenter' { 'Srv_Dtc' }
'Datacenter' { 'Srv_Dtc' } 'Datacenter' { 'Srv_Dtc' }
'Standard (Desktop Experience)' { 'Srv_Std_DE' }
'Datacenter (Desktop Experience)' { 'Srv_Dtc_DE' } 'Datacenter (Desktop Experience)' { 'Srv_Dtc_DE' }
} }
return $shortenedWindowsSKU return $shortenedWindowsSKU
@@ -135,7 +135,7 @@ $LogFileName = 'ScriptLog.txt'
$USBDrive = Get-USBDrive $USBDrive = Get-USBDrive
New-item -Path $USBDrive -Name $LogFileName -ItemType "file" -Force | Out-Null New-item -Path $USBDrive -Name $LogFileName -ItemType "file" -Force | Out-Null
$LogFile = $USBDrive + $LogFilename $LogFile = $USBDrive + $LogFilename
$version = '2412.3' $version = '2412.4'
WriteLog 'Begin Logging' WriteLog 'Begin Logging'
WriteLog "Script version: $version" WriteLog "Script version: $version"