One more function to add that complements the bin_to_str_guid function I posted below:
// This function will convert a string GUID value into a HEX value to search AD.
function str_to_hex_guid($str_guid) {
$str_guid = str_replace('-', '', $str_guid);
$octet_str = substr($str_guid, 6, 2);
$octet_str .= substr($str_guid, 4, 2);
$octet_str .= substr($str_guid, 2, 2);
$octet_str .= substr($str_guid, 0, 2);
$octet_str .= substr($str_guid, 10, 2);
$octet_str .= substr($str_guid, 8, 2);
$octet_str .= substr($str_guid, 14, 2);
$octet_str .= substr($str_guid, 12, 2);
$octet_str .= substr($str_guid, 16, strlen($str_guid));
return $octet_str;
}
If you want to convert the string GUID back to the HEX format (required if you want to search AD based on the GUID string, make sure you escape the HEX string with double backslashes when searching -- ie. \\AE\\0F\\88...).