NTAccount.Translate to SecurityIdentifier for <domain>\Administrat

G

Guest

Hi!
Can anyone please explain me why following code gives an SecurityException
"System.Security.SecurityException: The name provided is not a properly
formed account name."?

-- code start --

System.Security.Principal.NTAccount ntAccount = new
System.Security.Principal.NTAccount(@"<domain>\Administrators");
System.Security.Principal.SecurityIdentifier sid =
(System.Security.Principal.SecurityIdentifier)ntAccount.Translate(typeof(System.Security.Principal.SecurityIdentifier));

-- code end --

where "<domain>" in "<domain>\Administrators" is your Active Directory Domain.

Note:
<domain>\Administrators is a built-In group. It is visible trough 'Find'
dialog in Active Directory Users and Computers Snap-In.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top