我怎样才能获得客人/管理员本地组的名字吗? [英] How can I get the local group name for guests/administrators?

查看:142
本文介绍了我怎样才能获得客人/管理员本地组的名字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问:

我在使用中发现的code http://support.microsoft.com/kb/306273

I use the code found at http://support.microsoft.com/kb/306273

添加Windows用户。 问题是我需要将用户添加到组,但组名是局部的。

to add a windows user. The problem is i need to add the user to a group, but the groupnames are localized.

例如。在MS-示例使用英语的计算机,这意味着你可以得到的客群是这样的: GRP = AD.Children.Find(客人,集团)

E.g. the MS-example uses an english computer, which means you can get the guest group like this: grp = AD.Children.Find("Guests", "group")

但在非英语的计算机上,将客户组名是局部的,这意味着例如在我的德国语言的操作系统,对于客人的组名Gäste。

But on a non-english computer, the 'Guest' groupname is localized, meaning for example on my german language OS, the group name for Guests is "Gäste".

这意味着为支持例如在我的计算机上运行,​​我需要把上面一行 GRP = AD.Children.Find(Gäste,集团)

Which means for the support example to run on my computer i need to change that line to grp = AD.Children.Find("Gäste", "group")

然后它工作。

现在,如果操作系统是任何其他语言,我怎么能找到的guest用户名? 或者,如何从一个SID获取g​​uest用户名?

Now if the OS is any other language, how can I find the name for the guest user ? Or how can i get the guest user name from a sid ?

注:.NET 2.0,而不是3.0或3.5

Note: .NET 2.0, not 3.0 or 3.5

推荐答案

正如你所指出的,团体的名称是根据系统语言本地化。

As you have pointed out, the names of groups are localised depending on system language.

有关'众所周知'团状'管理员'和'客人',你应该找回的基础上的SID。该SID的客人是:

For 'well known' groups like 'Administrators' and 'Guests' you should retrieve based on the SID. The SID for Guests is:

S-1-5-32-546

还有就是众所周知的SID列表,在这里:

There is a list of well known SIDs here:

http://support.microsoft.com/kb/243330

code从SID获得的组名,可以找到<一href="http://stackoverflow.com/questions/499053/how-can-i-convert-from-a-sid-to-an-account-name-in-c">here

Code to get the group name from the SID can be found here

这篇关于我怎样才能获得客人/管理员本地组的名字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆