E
Evgeny Zoldin
Hi, ALL
I have user's Windows logon username - DOMAIN_NAME\Username
Then using classes DirectoryEntry and DirectorySeacher I can get from
domain's Active Directory user's first and last names and aother properties
of its profile by means of the following:
DirectoryEntry rootEntry = new DirectoryEntry("GC://rootDSE");
string domainPath =
rootEntry.Properties["defaultNamingContext"][0].ToString();
DirectoryEntry domain = new DirectoryEntry("LDAP://" + domainPath);
DirectorySearcher searcher = new DirectorySearcher(domain);
searcher.SearchScope = SearchScope.Subtree;
searcher.Filter = "(&(objectClass=user)(name=" + username + "))"; //
username without domain name
SearchResult res = searcher.FindOne();
if( res != null ) return res.GetDirectoryEntry();
else return null;
But still I don't know how to obtain users properties if user has only local
account on WindowsXP machine, but not Domain account. What the LDAP path to
Activy Directory of this local WinXP computer while computer is member of
Domain itself, but user is local user only?
Thanx
Evgeny
I have user's Windows logon username - DOMAIN_NAME\Username
Then using classes DirectoryEntry and DirectorySeacher I can get from
domain's Active Directory user's first and last names and aother properties
of its profile by means of the following:
DirectoryEntry rootEntry = new DirectoryEntry("GC://rootDSE");
string domainPath =
rootEntry.Properties["defaultNamingContext"][0].ToString();
DirectoryEntry domain = new DirectoryEntry("LDAP://" + domainPath);
DirectorySearcher searcher = new DirectorySearcher(domain);
searcher.SearchScope = SearchScope.Subtree;
searcher.Filter = "(&(objectClass=user)(name=" + username + "))"; //
username without domain name
SearchResult res = searcher.FindOne();
if( res != null ) return res.GetDirectoryEntry();
else return null;
But still I don't know how to obtain users properties if user has only local
account on WindowsXP machine, but not Domain account. What the LDAP path to
Activy Directory of this local WinXP computer while computer is member of
Domain itself, but user is local user only?
Thanx
Evgeny