Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Regional Settings

132 views
Skip to first unread message

Conner

unread,
Feb 25, 2003, 12:54:29 PM2/25/03
to
I am working for a support centre and need to know the following:

Is there a way to export the regional settings from a computer in a text
file, so that customers can send this to me for technical support purposes.
I.e. customers have an English OS, but use Dutch regional settings...

Thanks


Torgeir Bakken (MVP)

unread,
Feb 25, 2003, 11:03:19 PM2/25/03
to
Conner wrote:

Hi

E.g. with a script (for Win2k and WinXP):


sComputer = "." ' use "." for local computer

Set oShell = CreateObject("WScript.Shell")

On Error Resume Next
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer _
& "\root\cimv2")

If Err.Number = 0 Then
Set colOperatingSystems = oWMI.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each oOS in colOperatingSystems

iOSLang = oOS.OSLanguage
sOSLangHex = Right("000" & Hex(iOSLang), 4)

sOSCaption = oOS.Caption
sOSServicePack = oOS.CSDVersion
Next

Const HKCU = &H80000001
Const HKLM = &H80000002

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\default:StdRegProv")

sOSLanguage = "Unknown" ' Init value
sKeyPath = "SOFTWARE\Classes\MIME\Database\Rfc1766"
sValueName = sOSLangHex
oReg.GetStringValue HKLM, sKeyPath, sValueName, sOSLanguage

' remove unnecessary stuff
aOSLanguage = Split(sOSLanguage, ";")
sOSLanguage = aOSLanguage(UBound(aOSLanguage))
If Instr(sOSLanguage, "(") > 0 Then
aOSLanguage = Split(sOSLanguage, "(")
sOSLanguage = Trim(aOSLanguage(0))
End If

sKeyPath = "Control Panel\International"
sValueName = "sCountry"
oReg.GetStringValue HKCU, sKeyPath, sValueName, sCountry
On Error Goto 0

Set oFSO = CreateObject("Scripting.FileSystemObject")
Const OpenAsASCII = 0
sTmpFile = oShell.ExpandEnvironmentStrings("%TEMP%\tmp_sysinfo.txt")
Set fTmpFile = oFSO.CreateTextFile(sTmpFile, True, OpenAsASCII)

fTmpFile.WriteLine "OS version: " & sOSCaption
fTmpFile.WriteLine "SP version: " & sOSServicePack
fTmpFile.WriteLine "OS language: " & sOSLanguage

fTmpFile.WriteLine "Regional Settings for user is set to: " & sCountry

fTmpFile.Close
oShell.Run "Notepad " & sTmpFile
Else
Wscript.Echo "Error, could not connect with WMI!"
End If
On Error Goto 0

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


0 new messages