|
-
Jan 21st, 2010, 11:20 PM
#1
Thread Starter
^:^...ANGEL...^:^
[RESOLVED] Convert a SID to User/Group in ActiveDirectory or LocalMachine
Hi,
We are using Microsoft Authorization Manager (Start -> Run -> AzMan.msc). Anyways one of the store mechanism is to store things in an XML file. I need to write a utility which will analyze the file and show it's finding to the user.
It stores many things among which one is the SID of a User/Group or any object from ActiveDirectory or LocalMachine. Now that I got the SID, how do I find what type of object is it and how do I find it's properties?
I know I need to use the things from System.DirectoryServices and get things done but I am stuck at resolving what type of an object it is in the first place.
Could someone please help me out?
Cheers
Last edited by wrack; Mar 3rd, 2010 at 07:48 PM.
-
Jan 22nd, 2010, 01:26 AM
#2
Re: Convert a SID to User/Group in ActiveDirectory or LocalMachine
Hi wrack; long time between drinks,
Do you mean breaking a SID down into it's components like:
EG: S-1-5-21-7623811015-3361044348-030300820-1013
S = The string is a SID.
1 = The revision level (the version of the SID specification).
5 = The identifier authority value.
21-7623811015-3361044348-030300820 = domain or local computer identifier.
1013 = a Relative ID (RID). Any group or user that is not created by default will have a Relative ID of 1000 or greater.
(groups)
S-1-5-18 = Local System, a service account that is used by the operating system.
S-1-5-19 = NT Authority, Local Service.
S-1-5-20 = NT Authority, Network Service.
S-1-5-domain-500 = A user account for the system administrator. By default, it is the only user account that is given full control over the system.
Last edited by Bruce Fox; Jan 22nd, 2010 at 01:29 AM.
-
Mar 3rd, 2010, 07:44 PM
#3
Thread Starter
^:^...ANGEL...^:^
Re: Convert a SID to User/Group in ActiveDirectory or LocalMachine
Hey Bruce,
Long time no see indeed. I have been busy with life and things in life!
Anyways, no I didn't meant to decode the SID but I needed to retrieve the object assigned to that SID.
It's resolved now with the help of the code below.
Code:
try
{
pDirectoryEntry = new DirectoryEntry(String.Format("LDAP://<SID={0}>", ASID));
}
catch
{
return ASID;
}
Once you have a DirectoryEntry object that is not null then you can do a lot of things with it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|