Reputation: 13
I have knew the administrator Group sid(Well-know-sid) is "S-1-5-32-544", but I research the msdn, I don't find any way can retrieve the Group sid by groupName.
I use ::NetLocalGroupEnum to list all groupName. Moreover, I want to know which group is administrator Group. Administrator Group's name is "administrator" by default. If someone modifies Administrator Group's name(ex: from "administrator" to "123" ), how can I know the "123" is belong to administrator Group. Now I use String to determine which group is Administrator Group, but if Group Name is modified, this way is not work. I also use ::NetLocalGroupGetInfo, but it's output structure only include name and comment but not group SID. Is any API or way is about input is the groupName, and OutPut is Group sid? Thanks!
Upvotes: 1
Views: 1264
Reputation: 179867
Call LookupAccountSid()
on your "S-1-5-32-544" SID. You'll get back a name with type SidTypeGroup
.
As you correctly noted, the SID values are well-known (stable), so you use those as input. Account names can be localized, so those are the output.
Upvotes: 1
Reputation: 2719
I worked with PowerShell and found following information I hope this helps:
Get-ADGroup -Identity Administrators
that Administrators
is the name of your group
Upvotes: 0