Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the local group name for guests/administrators?

Question:

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

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

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")

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".

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")

then it works.

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 ?

Note: .NET 2.0, not 3.0 or 3.5

like image 612
Stefan Steiger Avatar asked Jul 09 '10 13:07

Stefan Steiger


People also ask

How do I find my local admin group?

To view users in a local group: Type net localgroup groupname, where groupname is the name of the group you want to list. For example, if the group name is Administrators, you would type net localgroup Administrators. Then press Enter.

What is a local admin group?

A Local Administrator is already outside the domain and has the full power to do anything desired on the location machine, which IS PART of the domain. They can decode any part of the machine they want and even remove sections of it from the control of the domain.

How do I find local admin Groups in Windows 10?

The fastest way to open Local Users and Groups is to type lusrmgr. msc in the search bar. If you prefer, you can also right-click on the Windows start menu and click on Computer Management.


1 Answers

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

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

There is a list of well known SIDs here:

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

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

like image 114
Cocowalla Avatar answered Oct 10 '22 00:10

Cocowalla