When searching Active Directory for the objectGUID attribute using ADO, I can convert the returned GUID to a string value with the following: $stringGUID = unpack("H*", $binaryGUID); This yields a string like this: b63e4661ea6fc545a88e103e54b8dc41, the same as that given when binding to an object with ADSI and requesting the $object->{objectGUID} property. I'm stuck trying to convert these string representations back to the appropriate binary representation to feed into an LDAP search filter. I assume there's a corresponding pack statement but am not sure what it might be. Any ideas? [Bullock, Howard A.] The Lanman.pm has these subroutine included that work well. sub GuidToString { return sprintf "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", unpack("I", $_[0]), unpack("S", substr($_[0], 4, 2)), unpack("S", substr($_[0], 6, 2)), unpack("C", substr($_[0], 8, 1)), unpack("C", substr($_[0], 9, 1)), unpack("C", substr($_[0], 10, 1)), unpack("C", substr($_[0], 11, 1)), unpack("C", substr($_[0], 12, 1)), unpack("C", substr($_[0], 13, 1)), unpack("C", substr($_[0], 14, 1)), unpack("C", substr($_[0], 15, 1)); } sub StringToGuid { return undef unless $_[0] =~ /([0-9,a-z]{8})-([0-9,a-z]{4})-([0-9,a-z]{4})-([0-9,a-z]{2})([0-9,a-z]{2})-([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})/i; return pack("I", hex $1) . pack("S", hex $2) . pack("S", hex $3) . pack("C", hex $4) . pack("C", hex $5) . pack("C", hex $6) . pack("C", hex $7) . pack("C", hex $8) . pack("C", hex $9) . pack("C", hex $10) . pack("C", hex $11); print "$1\n$2\n$3\n$4\n$5\n$6\n$7\n$8\n$9\n$10\n$11\n"; } _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs