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.
使用案例:必须应用安全设置和用户帐户创建的软件安装。脚本必须知道某些系统属性,例如OS的原始语言中的用户组名称。
(Should work with Windows XP, Windows Server 2003, Vista, ...)
(应该适用于Windows XP,Windows Server 2003,Vista,...)
3 个解决方案
#1
3
To detect the operating system language use GetSystemDefaultUILanguage.
要检测操作系统语言,请使用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.
但是,有更简单的方法可以在Windows中查找诸如已知组名之类的内容。例如,要获取Users组的名称,请使用WellKnownSidType = 27(WinBuiltinUsersSid)调用CreateWellKnownSid,然后调用LookupAccountSid。也可以查询其他知名用户和组的名称。
#2
1
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.
操作系统中的所有本地化名称都具有语言中立的方式来访问它们以供本机应用程序和设置脚本使用。管理员,用户,来宾组和管理员帐户具有众所周知的SID,可用于代替本地化名称。需要考虑的另一点是,内置主体的所有默认名称都可以更改,并且通常具有良好的含义但是混淆了系统管理员,相信将域管理员帐户或组名称更改为非默认值等于增加的安全性。即使是操作系统安装语言的正确名称,也不能依赖这些东西。更糟糕的是,某些语言本地化在一种语言的OS版本之间发生了变化。因此,您需要在OS版本和语言的预期名称之间构建一个非常仔细的映射。
Rather don't. Find out how to build the locale neutral id for your scripting environment.
相反不要。了解如何为脚本环境构建区域设置中立ID。
#3
0
My best solution so far: enumerate the local user accounts and groups and compare with a list of known names in different languages.
到目前为止,我的最佳解决方案:枚举本地用户帐户和组,并与不同语言的已知名称列表进行比较。
#1
3
To detect the operating system language use GetSystemDefaultUILanguage.
要检测操作系统语言,请使用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.
但是,有更简单的方法可以在Windows中查找诸如已知组名之类的内容。例如,要获取Users组的名称,请使用WellKnownSidType = 27(WinBuiltinUsersSid)调用CreateWellKnownSid,然后调用LookupAccountSid。也可以查询其他知名用户和组的名称。
#2
1
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.
操作系统中的所有本地化名称都具有语言中立的方式来访问它们以供本机应用程序和设置脚本使用。管理员,用户,来宾组和管理员帐户具有众所周知的SID,可用于代替本地化名称。需要考虑的另一点是,内置主体的所有默认名称都可以更改,并且通常具有良好的含义但是混淆了系统管理员,相信将域管理员帐户或组名称更改为非默认值等于增加的安全性。即使是操作系统安装语言的正确名称,也不能依赖这些东西。更糟糕的是,某些语言本地化在一种语言的OS版本之间发生了变化。因此,您需要在OS版本和语言的预期名称之间构建一个非常仔细的映射。
Rather don't. Find out how to build the locale neutral id for your scripting environment.
相反不要。了解如何为脚本环境构建区域设置中立ID。
#3
0
My best solution so far: enumerate the local user accounts and groups and compare with a list of known names in different languages.
到目前为止,我的最佳解决方案:枚举本地用户帐户和组,并与不同语言的已知名称列表进行比较。