Here's an easy way to encode AD "unicodepwd" values from linux...
Download and install recode...
http://www.gnu.org/software/recode/recode.html
Then write something like this...
<?php
function ADUnicodePwdValue($plain_txt_value)
{
return str_replace("\n", "", shell_exec("echo -n '\"" . $plain_txt_value . "\"' | recode latin1..utf-16le/base64"));
}
$user["unicodepwd"] = ADUnicodePwdValue("my_password");
?>
[EDITOR thiago NOTE: The following text was sent by boyvanderlaak at gmail dot com as an important complement]
if you do not have access to your linux box but have Multibyte String enabled you could try the following for AD 2008:
<?php
$info["unicodePwd"] = mb_convert_encoding('"' . $newPassword . '"', 'utf-16le');
?>