This script identifies OS architecture and SKU by matching English-localized strings, which will display wrong result when using non-English version of Windows.
⚠ 請勿編輯此區段。 這是 docs.microsoft.com ➟ GitHub 問題連結的必要項。
@vinixwu , the reason is simple , becuase entire script written only in the English language only. So non english based system , script might not work
Minor addendum: The script has been updated to adjust for German & Dutch Windows localization issues (commits https://github.com/MicrosoftDocs/windows-itpro-docs/commit/c8766851ce7050222dc6633946a66f50f7bd7127 & https://github.com/MicrosoftDocs/windows-itpro-docs/commit/e25231e6ffc23ef6109b9a9bd5e791902c95f6d6) to account for more than one representation of "64 bit" and "32 bit", but the script would need a major code rewrite to work in other Windows languages.
Not sure how much coding is involved for languages other than German, French & Spanish, but it could possibly be seen as a "porting" job for the script.
@vinixwu , the reason is simple , becuase entire script written only in the English language only. So non english based system , script might not work
I knew. I read the script and found this problem. ;)
I found that
(Get-ComputerInfo).WindowsProductName
returns english-localized string on my Traditional Chinese OS. Can it be used to replace
(gwmi win32_operatingsystem).Name
in function CheckOSSKU?
@RvdHout - would you like to evaluate the comment suggestion above, https://github.com/MicrosoftDocs/windows-itpro-docs/issues/8672#issuecomment-731091813 ?
@illfated
For me both return basically the same values,
$((gwmi win32_operatingsystem).Name).ToLower()
microsoft windows 10 pro|c:\windows|\device\harddisk1\partition4
$osname = $((Get-ComputerInfo).WindowsProductName).ToLower()
windows 10 pro
@RvdHout : Thank you for replying. Would you like to recommend a tested and working change to the script, using the suggested change from @vinixwu ?
@illfated, not sure what you want me to do....like i said, that suggested code change makes no difference on a Dutch Windows 10 installation, both methods pass the CheckOSSKU check
$SKUarray = @("Enterprise", "Education", "IoT", "Windows Server", "Pro", "Home")
So this will pass (as it only looks for: pro, home etc) on:
$((gwmi win32_operatingsystem).Name).ToLower()
microsoft windows 10 pro|c:\windows|\device\harddisk1\partition4
$osname = $((Get-ComputerInfo).WindowsProductName).ToLower()
windows 10 pro
🙂 Fair enough. I just wanted to make sure exactly which details need to be changed to open a pull request (by editing the script on the page and saving those, then continue filling in the PR comment). Anyone could do it, but since I am more than familiar with it (working with document PR changes 7 days a week), I suppose it often seems more readily available for me to start working on it.
@RvdHout: It would have localized value when using
(gwmi win32_operatingsystem).Name
on a Traditional Chinese OS. In other words, CheckOSSKU will always fail.
That's why I suggest
(Get-ComputerInfo).WindowsProductName
, because it returns the same value as yours.
Thanks to all of you for participating. I am prepared to open a Pull Request to have the script content updated and improved for wider language-agnostic usage, but I would very much like to see feedback containing examples of successful use of the necessary changes before I start working on said changes.
Hello @vinixwu ,
I reviewed the script,
and I believe the (gwmi win32_operatingsystem).Name could be replaced by (Get-ComputerInfo).WindowsProductName only if you change line $HLKAllowed = @("microsoft windows 10 pro") to $HLKAllowed = @("windows 10 pro"), because Get-ComputerInfo doesn't contain "microsoft" in its output.
Thank you
PR #8895 is now available for review, comments, and suggestions.
Most helpful comment
Hello @vinixwu ,
I reviewed the script,
and I believe the (gwmi win32_operatingsystem).Name could be replaced by (Get-ComputerInfo).WindowsProductName only if you change line $HLKAllowed = @("microsoft windows 10 pro") to $HLKAllowed = @("windows 10 pro"), because Get-ComputerInfo doesn't contain "microsoft" in its output.
Thank you