Check the OS language in a SCCM task sequence and set an TS variable

From The IT Community
Revision as of 01:04, 15 December 2013 by Hutti (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search




Sometimes you may want to check the language of the OS while you are in the Task Sequence, for example if you create an offline medium and the user selected the language manually (if you have a language pack integrated into your Windows WIM file)

Dim smsTSenv : Set smsTSenv = CreateObject("Microsoft.SMS.TSEnvironment")
Dim objOS, UILanguage, OSLanguage, strDisplay
'query OSLanguage from WMI using Win32_OperatingSystem class
if smsTSenv("UILanguage") = "" then
For Each objOS In GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")
              OSLanguage=objOS.OSLanguage
              'OSLanguage=objOS.MUILanguages
Next

Select Case OSLanguage
              Case 1031 UILanguage = "de-DE" : strDisplay = "German"
              Case 1032 UILanguage = "el-GR" : strDisplay = "Greek"
              Case 1034 UILanguage = "es-ES" : strDisplay = "Spanish"
              Case 1036 UILanguage = "fr-FR" : strDisplay = "French"
              Case 1040 UILanguage = "it-IT" : strDisplay = "Italian"
              Case 1041 UILanguage = "ja-JP" : strDisplay = "Japanese"
              Case 1042 UILanguage = "ko-KR" : strDisplay = "Korean"
              Case 1043 UILanguage = "nl-NL" : strDisplay = "Dutch"
              Case 1044 UILanguage = "nb-NO" : strDisplay = "Norwegian Bokmal"
              Case 1045 UILanguage = "pl-PL" : strDisplay = "Polish"
              Case 1048 UILanguage = "ro-RO" : strDisplay = "Romanian"
              Case 1049 UILanguage = "ru-RU" : strDisplay = "Russian"
              Case 1051 UILanguage = "sk-SK" : strDisplay = "Slovak"
              Case 1053 UILanguage = "sv-SE" : strDisplay = "Swedish"
              Case 1060 UILanguage = "sl-SL" : strDisplay = "Slovenian"
              Case 1028, 2052, 4100, 5124 UILanguage = "ch-CN" : strDisplay = "Chinese Simplified"
              Case 2070 UILanguage = "pt-PT" : strDisplay = "Portuguese"
              Case 3076 UILanguage = "ch-HK" : strDisplay = "Chinese Hong Kong"
              Case Else
              UILanguage = "en-US" : strDisplay = "English US" '1033
End Select

WScript.Echo "Detected Language: " & UILanguage & " (" & strDisplay & ")" 
' Set UILanguage as Task Sequence Variable
smsTSenv("UILanguage") = UILanguage
end if
' Set all objects to nothing
Set objOS = Nothing : Set smsTSenv = Nothing


This scrip sets the TS variable "UILanguage" which you can than use in your Task Sequence :-)

Have fun!



Was this article helpful? Then please donate to keep The IT Community alive...

If you found this article helpful please share it, comment and help others by writing your own article.






Translate this page:




Articles found in the same category:
(max. 20 shown)