I am trying to get user AD entry information using the entry's property dictionary. I want to get specific user info (ie account locked, etd); however, when I view the keys for entry's property dictionary I do not see a key for
userAccountControl and when I run the code the user.Properties["userAccountControl"].Value returns null. What am I doing wrong? see code below:
DirectoryEntry user = new DirectoryEntry("LDAP://" + server +
"/" +
objectDn, userName, password);
int val = (int)user.Properties["userAccountControl"].Value;
//newUser is DirectoryEntry object
user.Properties["userAccountControl"].Value = val | 0x80000;
user comes back with everything. When; however, I look at the propereties Key values there are somewhere around 32 values but none are "userAccountControl".
Member
57 Points
188 Posts
DirectoryEntry entry return value's Properties key userAccountControl not found and returns null
Sep 30, 2014 03:01 PM|uid633445|LINK
I am trying to get user AD entry information using the entry's property dictionary. I want to get specific user info (ie account locked, etd); however, when I view the keys for entry's property dictionary I do not see a key for userAccountControl and when I run the code the user.Properties["userAccountControl"].Value returns null. What am I doing wrong? see code below:
DirectoryEntry user = new DirectoryEntry("LDAP://" + server + "/" +
objectDn, userName, password);
int val = (int)user.Properties["userAccountControl"].Value;
//newUser is DirectoryEntry object
user.Properties["userAccountControl"].Value = val | 0x80000;
All-Star
35149 Points
9075 Posts
Re: DirectoryEntry entry return value's Properties key userAccountControl not found and returns...
Sep 30, 2014 03:05 PM|smirnov|LINK
Is user null too or it's pointed to the right DirectoryEntry?
Member
57 Points
188 Posts
Re: DirectoryEntry entry return value's Properties key userAccountControl not found and returns...
Sep 30, 2014 03:22 PM|uid633445|LINK
user comes back with everything. When; however, I look at the propereties Key values there are somewhere around 32 values but none are "userAccountControl".
All-Star
35149 Points
9075 Posts
Re: DirectoryEntry entry return value's Properties key userAccountControl not found and returns...
Sep 30, 2014 03:46 PM|smirnov|LINK
Did you try to access LDAP under admin account to see if maybe there is an issue with a security?