strat has asked for the wisdom of the Perl Monks concerning the following question:
Hello
For my work, I need to get a list of users from an Active Directory (Win2003) including a lot of subdomains and write them to an LDIF file. Well, I decided to try it with Perl and ADSI and basically it works fine.
But there is one problem: I need to convert binary attribute values (e.g. objectGUID) to hex, but I don't know how to find out if a value is binary or not.
Here are some fragments of my code, stripped down to the essentials
# $adsPath is a path to a single userobject returned by a # previous search by the global catalog, just GC:// replaced # with LDAP://, e.g. # LDAP://ADS_Server/CN=Panther\, Paul,OU=test,DC=xyz,DC=de my $object = Win32::OLE->GetObject($adsPath); unless ($object) { # ... } foreach my $attr (@$attributeList) { if (ref($object->{$attr}) eq 'ARRAY') { # ... } # if elsif (ref($object->{$attr})) { # ... } # elsif elsif (defined $object->{$attr}) { if ( ???????? ) { # binary -> print as hex-string print "$attr: ", unpack("H*", $value), "\n"; } # if else { # text -> print as text print "$attr: $value\n"; } # else } # elsif } # foreach # .....
Do you know how I can find it out with ADSI?
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ADSI -> how to recognize binary attribute values
by Anonymous Monk on Dec 02, 2004 at 14:48 UTC | |
by strat (Canon) on Dec 02, 2004 at 15:33 UTC |