views:

1346

answers:

3

Required is the true language version of the OS, not the user interface language or the current locale settings.

Use case: software installation which has to apply security settings and user account creation. The scripts have to know certain system properties like user group names in the original language of the OS.

(Should work with Windows XP, Windows Server 2003, Vista, ...)

A: 

My best solution so far: enumerate the local user accounts and groups and compare with a list of known names in different languages.

gyrolf
+2  A: 

To detect the operating system language use GetSystemDefaultUILanguage.

However, there are more straightforward ways to find things such as a known group name in Windows. For example, to get the name for the Users group call CreateWellKnownSid with WellKnownSidType = 27 (WinBuiltinUsersSid) and then LookupAccountSid. The name for other well-known users and groups may be queried as well.

Romulo A. Ceccon
+1  A: 

All localized names in the OS have a language neutral way to access them for use by native applications and setup scripts. the administrators, users, guests groups and administrator account have well known SIDs that can be used in place of a localized name. An extra point to consider is that all the default names of the built in principals can be changed, and often are by well meaning but confused sys admins that belive that changing the domain admins account or group names to a non default equals increased security. You cannot rely on these things even being the correct name for the OS's installation language. Even worse, some of the language localizations change between OS releases for a language. So you would need to construct a very careful mapping between OS versions and expected names for languages.

Rather don't. Find out how to build the locale neutral id for your scripting environment.

Chris Becke