Git Product home page Git Product logo

Comments (7)

mmashwani avatar mmashwani commented on June 17, 2024

This issue should now be resolved in the beta 3.6.4 located here: https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/tree/master/Toolkit/AppDeployToolkit

Please test and let me know if it's working as expected now.

from psappdeploytoolkit.

Fatbob1 avatar Fatbob1 commented on June 17, 2024

Hi

I have first to excuse myself because i've a (couple of) mistakes :
1/ The path to check for the Computer GPO is :
HKLM\SOFTWARE\Policies\Microsoft\MUI\Settings' -Value 'PreferredUILanguages'
2/ I also made a Typo because in "PreferredUILanguages" I forgot the 1 "rr"

Enough with my errors, and after correction in you code , now the results
-- The detection for the "free" (no GPO applied) works fine
-- But the Detection for setting by GPO so far i not working : It gets only the "free" setting, the one I speak about in the previous Point. I've spent countless of hours to figure out where the problem might be (Typo, registry wrong path) and of course I didn't find something so far. I behaves just like for whatever reason the script can not read the EXISTING registry keys. The thing I've noticed is that for the GPO the Value is REG_SZ and for the "free" setting is REG_Multi_SZ .. I am a bit out of idea since I can not trace $HKULanguages after each reading in the registry.. that would really help (If I use the write-log function with the variable, the script just does not run.. but I might be wring somewhere or the value read is somehow "out of range)

My code :

'# If a user is logged on, then get primary UI language for logged on user (even if running in session 0)
If ($RunAsActiveUser) {
# Read language defined by Group Policy
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKLM\SOFTWARE\Policies\Microsoft\MUI\Settings' -Value 'PreferredUILanguages'
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\SOFTWARE\Polices\Microsoft\Control Panel\Desktop' -Value 'PreferredUILanguages' -SID $RunAsActiveUser.SID
}
# Read language for Win 8 machines
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\International\User Profile' -Value 'Languages' -SID $RunAsActiveUser.SID
# Read language for Win Vista/Win 7 machines
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\Desktop' -Value 'PreferredUILanguages' -SID $RunAsActiveUser.SID
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\Desktop\MuiCached' -Value 'MachinePreferredUILanguages' -SID $RunAsActiveUser.SID
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\International' -Value 'LocaleName' -SID $RunAsActiveUser.SID
}
# Read language for Win XP machines
If (-not $HKULanguages) {
[int32]$HKULocale = Get-RegistryKey -Key 'HKCU\Control Panel\International' -Value 'Locale' -SID $RunAsActiveUser.SID
If ([string]$HKULocale) {
[int32]$HKULocale = '0x' + $HKULocale
[string[]]$HKULanguages = (Globalization.CultureInfo).Name
}
}

from psappdeploytoolkit.

Fatbob1 avatar Fatbob1 commented on June 17, 2024

Back On the desk

I finally out what the problem was. Since I 've found a way to trace the variable -Big deal ;-) - I've quickly discovered that it was very well detected for the GPO setting BUT after that the script tries to read the variable for "Win 8"... and since, obviously, it does not exist on Win7, it is reset to a null value. Therefore when it comes to the "free" setting the test sees a null variable and the sets it to the free setting. To make it shorter : the test on Win 8 was missing.

That's the code that is working for me on Win7 x64 :

'# If a user is logged on, then get primary UI language for logged on user (even if running in session 0)
If ($RunAsActiveUser) {
# Read language defined by Group Policy
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKLM\SOFTWARE\Policies\Microsoft\MUI\Settings' -Value 'PreferredUILanguages'
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\SOFTWARE\Policies\Microsoft\Control Panel\Desktop' -Value 'PreferredUILanguages' -SID $RunAsActiveUser.SID
}
# Read language for Win 8 machines
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\International\User Profile' -Value 'Languages' -SID $RunAsActiveUser.SID
}
# Read language for Win Vista/Win 7 machines
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\Desktop' -Value 'PreferredUILanguages' -SID $RunAsActiveUser.SID
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\Desktop\MuiCached' -Value 'MachinePreferredUILanguages' -SID $RunAsActiveUser.SID
}
If (-not $HKULanguages) {
[string[]]$HKULanguages = Get-RegistryKey -Key 'HKCU\Control Panel\International' -Value 'LocaleName' -SID $RunAsActiveUser.SID
}
# Read language for Win XP machines
If (-not $HKULanguages) {
[int32]$HKULocale = Get-RegistryKey -Key 'HKCU\Control Panel\International' -Value 'Locale' -SID $RunAsActiveUser.SID
If ([string]$HKULocale) {
[int32]$HKULocale = '0x' + $HKULocale
[string[]]$HKULanguages = (Globalization.CultureInfo).Name
}
}

from psappdeploytoolkit.

mmashwani avatar mmashwani commented on June 17, 2024

Thanks for testing out the beta 3.6.4. I've made the appropriate changes as discussed above. Please test the latest code again and let me know if it's working as expected.

from psappdeploytoolkit.

Fatbob1 avatar Fatbob1 commented on June 17, 2024

Hi

I'll will test on thursday and let you know

Best regards

from psappdeploytoolkit.

Fatbob1 avatar Fatbob1 commented on June 17, 2024

Hi

So I did all the test i could foresee and it works well in any configuration on Win7x64 except in only in one case : the User GPO. The right registry key is
'HKCU\Software\Polices\Microsoft\Control Panel\Desktop'
and in the code it is :
'HKCU\Software\Polices\Control Panel\Desktop' (line 254) : 'Microsoft' key is missing

Best regards

from psappdeploytoolkit.

mmashwani avatar mmashwani commented on June 17, 2024

Great, thanks for all your help. I've updated the code with the right key.

from psappdeploytoolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.