Post by ajmote on Jan 8, 2021 16:51:55 GMT
jason - Amazing tool you have here. Thank you for creating it!
Request: Maybe this data could made available in a future version automatically? and stored in a variable?
Request: The BIOS version as well of a device as well. (<Action Type="WMIRead" Namespace="Root\CIMv2" Query="Select SMBIOSBIOSVersion From Win32_BIOS" Property="SMBIOSBIOSVersion" Variable="BiosVersion"/>)
Info: Hi all, I appreciate any help anybody can offer with this issue. I am trying to dynamically use your choice list option within WindowsPE for language selection. I optimally do not want to define languages statically within the XML. This is for native SCCM without and UDI. In short, I enumerate the available languages and time zones using powershell during WindowsPE startup. I formulate the results as a comma-separated list and store the data within the registry. This is all working great! I use UI++ to retrieve the registry values so that a technician can select them. The data is sorted, filtered, and confirmed as 1 to 1, meaning each language display name has an associated language code. This is all working well!
Problem: The values are not being fed into UI++ in a 1 to 1 fashion. They are being mismatched. There are roughly 400 language options.
Example: User selects "English (United States)" and language code comes out as "en-VG" when it should be "en-US"
Reminder: The data is sorted within powershell before going into the registry, so when the data is stored in two separate registry values, the values should match up on the way into UI++.
Am I seeing or thinking about this in the wrong fashion, or is UI++ possibly limited to set number of choice options? Could it be special characters in my data which cause the parsing to get tripped up?
Powershell Code (Runs when WindowsPE starts)
Results:
* Adding Choice: ' English (Uganda)', value: ' English (Uganda)', alternate value: ' en-US' <- This value should have been assigned to "English (United States)"
* Adding Choice: ' English (US Minor Outlying Islands)', value: ' English (US Minor Outlying Islands)', alternate value: ' en-VC'
* Adding Choice: ' English (United States)', value: ' English (United States)', alternate value: ' en-VG' <- See this mismatch?
* Adding Choice: ' English (Saint Vincent and the Grenadines)', value: ' English (Saint Vincent and the Grenadines)', alternate value: ' en-VI'
* Adding Choice: ' Somali (Somalia)', value: ' Somali (Somalia)', alternate value: ' sw-UG'
Note: I have already tried tampering with the sort functionality within the XML. So I set Sort="False", but it does not seem to help.
XML (UI++ Configuration Code)
Request: Maybe this data could made available in a future version automatically? and stored in a variable?
Request: The BIOS version as well of a device as well. (<Action Type="WMIRead" Namespace="Root\CIMv2" Query="Select SMBIOSBIOSVersion From Win32_BIOS" Property="SMBIOSBIOSVersion" Variable="BiosVersion"/>)
Info: Hi all, I appreciate any help anybody can offer with this issue. I am trying to dynamically use your choice list option within WindowsPE for language selection. I optimally do not want to define languages statically within the XML. This is for native SCCM without and UDI. In short, I enumerate the available languages and time zones using powershell during WindowsPE startup. I formulate the results as a comma-separated list and store the data within the registry. This is all working great! I use UI++ to retrieve the registry values so that a technician can select them. The data is sorted, filtered, and confirmed as 1 to 1, meaning each language display name has an associated language code. This is all working well!
Problem: The values are not being fed into UI++ in a 1 to 1 fashion. They are being mismatched. There are roughly 400 language options.
Example: User selects "English (United States)" and language code comes out as "en-VG" when it should be "en-US"
Reminder: The data is sorted within powershell before going into the registry, so when the data is stored in two separate registry values, the values should match up on the way into UI++.
Am I seeing or thinking about this in the wrong fashion, or is UI++ possibly limited to set number of choice options? Could it be special characters in my data which cause the parsing to get tripped up?
Powershell Code (Runs when WindowsPE starts)
#Write registry values that will be gathered and displayed in UI++ Configuration or any for any other purpose
$ComputerName = "$($Env:ComputerName)"
[Microsoft.Win32.RegistryHive]$RegistryHive = [Microsoft.Win32.RegistryHive]::LocalMachine
[String]$RootKeyPath = "Software"
[String]$SubKeyName = "WPEInitialization"
$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($RegistryHive, $ComputerName)
$Software = $Registry.OpenSubKey($RootKeyPath, $True)
$Null = $Software.CreateSubKey($SubkeyName)
$NewRegistryKey = $Registry.OpenSubKey("$($RootKeyPath)\\$($SubkeyName)", [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree)
$CurrentTimeZone = Get-TimeZone
[Regex]$CurrentTimeZoneExpression = "^Local$"
Switch ($CurrentTimeZone)
{
{($_.ID -imatch $CurrentTimeZoneExpression.ToString())}
{
$Values.Add('CurrentTimeZone', 'Eastern Standard Time')
}
{($_.ID -inotmatch $CurrentTimeZoneExpression.ToString())}
{
$Values.Add('CurrentTimeZone', ($CurrentTimeZone.ID))
}
}
$TimeZones = Get-TimeZone -ListAvailable | Sort-Object -Property @('ID') | Select-Object -Property @('*')
$TimeZoneIDs = $TimeZones.ID
$Values.Add('TimeZones', ($TimeZoneIDs -Join ', '))
$CurrentCulture = [System.Globalization.CultureInfo]::CurrentCulture
$Values.Add('CurrentCultureDisplayName', ($CurrentCulture.DisplayName))
$Values.Add('CurrentCultureName', ($CurrentCulture.Name))
$Cultures = ([System.Globalization.CultureInfo]::GetCultures('AllCultures')) | Where-Object {($_.Name -imatch "^.{2,2}\-.{2,2}$")} | Sort-Object -Property @('Name') | Select-Object -Property @('*')
[String[]]$CultureDisplayNames = @()
[String[]]$CultureNames = @()
[String[]]$CultureLCIDs = @()
[String[]]$KeyboardLayoutIDs = @()
ForEach ($Item In $Cultures)
{
$CultureDisplayNames += "$($Item.DisplayName)"
$CultureNames += "$($Item.Name)"
$CultureLCIDs += "$($Item.LCID)"
$KeyboardLayoutIDs += "$($Item.KeyboardLayoutID)"
$Item = $Null
}
$Values.Add('CultureDisplayNames', ($CultureDisplayNames -Join ', '))
$Values.Add('CultureNames', ($CultureNames -Join ', '))
$Values.Add('CultureLCIDs', ($CultureLCIDs -Join ', '))
$Values.Add('KeyboardLayoutIDs', ($KeyboardLayoutIDs -Join ', '))
ForEach ($Item In ($Values.GetEnumerator() | Sort-Object -Property Key))
{
$Path = "$($NewRegistryKey.Name)"
$Name = "$($Item.Key)"
$Value = ($Item.Value)
$Kind = [Microsoft.Win32.RegistryValueKind]::String
$LogMessage = "Attempting to create registry value `"$($Name)`" in key path `"$($Path)`". Please Wait..."
Write-Verbose -Message "$($LogMessage)" -Verbose
$Null = $NewRegistryKey.SetValue("$($Name)", ($Value), ($Kind))
}
$Null = $Software.Close()
$Null = $Registry.Close()
Results:
* Adding Choice: ' English (Uganda)', value: ' English (Uganda)', alternate value: ' en-US' <- This value should have been assigned to "English (United States)"
* Adding Choice: ' English (US Minor Outlying Islands)', value: ' English (US Minor Outlying Islands)', alternate value: ' en-VC'
* Adding Choice: ' English (United States)', value: ' English (United States)', alternate value: ' en-VG' <- See this mismatch?
* Adding Choice: ' English (Saint Vincent and the Grenadines)', value: ' English (Saint Vincent and the Grenadines)', alternate value: ' en-VI'
* Adding Choice: ' Somali (Somalia)', value: ' Somali (Somalia)', alternate value: ' sw-UG'
Note: I have already tried tampering with the sort functionality within the XML. So I set Sort="False", but it does not seem to help.
XML (UI++ Configuration Code)
<ActionGroup Name="Initialization">
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CurrentCultureDisplayName" Variable="CurrentCultureDisplayName"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CurrentCultureName" Variable="CurrentCultureName"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CultureDisplayNames" Variable="CultureDisplayNames"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CultureNames" Variable="CultureNames"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CultureLCIDs" Variable="CultureLCIDs"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="KeyboardLayoutIDs" Variable="KeyboardLayoutIDs"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="CurrentTimeZone" Variable="CurrentTimeZone"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="TimeZones" Variable="TimeZones"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\WPEInitialization" Value="TSInProgress" Variable="TSInProgress"/>
</ActionGroup>
<Action Type="Input" Title="Regional Settings" Size="Regular" ShowBack="False" ShowCancel="True">
<ChoiceInput Variable="SelectedCultureDisplayName" AlternateVariable="OSDWindowsSettingsSystemLocale" Condition='"%CultureDisplayNames%" <> "" And "%CultureNames%" <> "" And "%OSDWindowsSettingsSystemLocale%" = ""' Default="%CurrentCultureDisplayName%" Question="Please select a language" Required="True" Sort="True" AutoComplete="False">
<ChoiceList OptionList="%CultureDisplayNames%" ValueList="%CultureDisplayNames%" AlternateValueList="%CultureNames%"/>
</ChoiceInput>
<ChoiceInput Variable="OSDTimeZoneOverride" Condition='"%TimeZones%" <> "" And "%OSDTimeZone%" = ""' Default="%CurrentTimeZone%" Question="Please select a time zone" Required="True" Sort="True" AutoComplete="False">
<ChoiceList OptionList="%TimeZones%"/>
</ChoiceInput>
</Action>