Have you visit here?
http://www.microsoft.com/technet/scr...s/default.mspx
chanmm
"Pere Raphael" <Pe**@community .nospam> wrote in message news:uE******** ******@TK2MSFTN GP04.phx.gbl...
Hi Dave,
Thanks for your reply.
I tried the suggestion but I get an error message.
It's possible that I have not explained my problem clearly.
Please the relevant part of my code.
When I get the AD search result for user with "surname", I display the user's CN and userPassword.
Instead of being shown the password, I get System.Byte[].
Apparently adObject.Proper ties["userPasswo rd"][0] is an object so can't convert to string.
Hope you're able to help.
Basicly trying to write code to email user's password to the user.
Thanks again,
Pere
DirectorySearch er adSearcherObjec t = new DirectorySearch er(adFolderObje ct);
adSearcherObjec t.SearchScope = SearchScope.Sub tree;
Console.Write(" Enter name to search for: ");
surname = Console.ReadLin e();
adSearcherObjec t.Filter = "(&(ObjectClass =user)(sn=" + surname + "))";
foreach (SearchResult adObject in adSearcherObjec t.FindAll())
{
count++;
found = true;
Console.WriteLi ne("CN={0}", adObject.Proper ties["CN"][0]);
PasswordString = System.Text.Enc oding.Default.G etString(adObje ct.Properties["userPasswo rd"][0]);
Console.WriteLi ne(PasswordStri ng);
"Dave Sexton" <dave@jwa[remove.this]online.com> wrote in message news:O2******** ******@TK2MSFTN GP03.phx.gbl...
Hi Pere,
System.Text.Enc oding.Default.G etString(bytes) ;
You can replace "Default" with any of ASCII, UTF32, UTF8, UTF7, Unicode and
BigEndianUnicod e if you'd like to match the appropriate encoding.
HTH
"Pere Raphael" <Pe**@community .nospam> wrote in message
news:uY******** ******@TK2MSFTN GP03.phx.gbl... Hi all,
I am writng some code to read AD user properties but I am not having much
luck reading octet values. For example, there is a property userPassword
which returns System.Byte[].
When I use ADSIEDIT, I can see the value in the format 0x077 0x043 0x064
0x055 0x072 0x054 0x44 0x058 which I can convert by using Character Map.
Does anyone know how I can get the value of this property.
Regards,
Pere
PS: I am very new to C#