Tuesday, February 19, 2008

Find localized name of the Everyone group

Today a colleague asked me if there is any way to find out what the Everyone group is called in a localized version of Windows. In a Swedish Windows, this group is kalled "Alla" and in a German version it's called "Jeder" etc.

There is an easy way to do this with .NET with the (new) .NET 2.0 Security functions.

SecurityIdentifier si = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
NTAccount everyOneGroup = si.Translate(typeof(NTAccount)) as NTAccount;
if (everyOneGroup != null) {
Console.WriteLine(everyOneGroup.Value); // now contains the localized name
}

No comments: