Ries
Ries

Reputation: 2866

Determine the name of the local Administrators group in Vista

How can I determine the name of the local Administrators group in Vista? This can vary depending on the operating system language.

Upvotes: 1

Views: 521

Answers (2)

Richard
Richard

Reputation: 109130

Look it up by the well known SID.

In .NET you can use the enum value: System.Security.Principal.BuiltinAdministratorsSid

In Win32 you can use the enum value: WELL_KNOWN_SID_TYPE.WinBuiltinAdministratorsSid and see MSDN for details.

Upvotes: 3

sisve
sisve

Reputation: 19791

As Richard proposes, use the wellknown sid to find the group.

var adminGroupSid = new SecurityIdentifier("S-1-5-32-544");
var adminGroup = (NTAccount)adminGroupSid.Translate(typeof(NTAccount));
var adminGroupName = adminGroup.Value;

Upvotes: 2

Related Questions