Does anyone have a good way to detect the OS Language Windows is using with
VBScript?

Thanks
Tom

Re: Detecting the OS Language by Torgeir

Torgeir
Tue Jul 19 10:57:45 CDT 2005

Thomas A. Bosscher wrote:

> Does anyone have a good way to detect the OS Language Windows
> is using with VBScript?
Hi,

With a VBScript and WMI:

'--------------------8<----------------------
sComputer = "." ' use "." for local computer
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer _
& "\root\cimv2")

Set colOperatingSystems = oWMI.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each oOS in colOperatingSystems
iOSLang = oOS.OSLanguage
Next

WScript.Echo "Decimal OS language number: " & iOSLang
WScript.Echo "Hex OS language number: " & Right("000" & Hex(iOSLang), 4)
'--------------------8<----------------------

The script above will return 1033 (hex 0409) for an English OS.

You can map the hex value to the country using the list under
this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Rfc1766


For a script that does this for you automatically, take a
look at this link:

http://groups.google.co.uk/group/microsoft.public.win2000.registry/msg/060db6e5dbf49427?dmode=source

It will give you this type of information/output:

OS version: Microsoft Windows 2000 Professional
SP version: Service Pack 2
OS language: English
Regional Settings for user is set to: Norway



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Detecting the OS Language by thomasabosscher(cutout)

thomasabosscher(cutout)
Tue Jul 19 12:23:03 CDT 2005

Thank you! That is exactly what I was looking for.

Have a great week,
Tom

"Torgeir Bakken (MVP)" wrote:

> Thomas A. Bosscher wrote:
>
> > Does anyone have a good way to detect the OS Language Windows
> > is using with VBScript?
> Hi,
>
> With a VBScript and WMI:
>
> '--------------------8<----------------------
> sComputer = "." ' use "." for local computer
> Set oWMI = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & sComputer _
> & "\root\cimv2")
>
> Set colOperatingSystems = oWMI.ExecQuery _
> ("Select * from Win32_OperatingSystem")
>
> For Each oOS in colOperatingSystems
> iOSLang = oOS.OSLanguage
> Next
>
> WScript.Echo "Decimal OS language number: " & iOSLang
> WScript.Echo "Hex OS language number: " & Right("000" & Hex(iOSLang), 4)
> '--------------------8<----------------------
>
> The script above will return 1033 (hex 0409) for an English OS.
>
> You can map the hex value to the country using the list under
> this registry key:
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Rfc1766
>
>
> For a script that does this for you automatically, take a
> look at this link:
>
> http://groups.google.co.uk/group/microsoft.public.win2000.registry/msg/060db6e5dbf49427?dmode=source
>
> It will give you this type of information/output:
>
> OS version: Microsoft Windows 2000 Professional
> SP version: Service Pack 2
> OS language: English
> Regional Settings for user is set to: Norway
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>