Update: Looks like I missed the code far down in the IFRAME. I'm not sure if I'm converting from the format you have, but the following should help you.
use strict; use warnings; use Win32::OLE (); # Constants for the NameTranslate object. use constant ADS_NAME_INITTYPE_GC => 3; use constant ADS_NAME_TYPE_1779 => 1; use constant ADS_NAME_TYPE_NT4 => 3; # Specify the Display Name of the user. my $nt_name = $ENV{USERDOMAIN} . '\\' . $ENV{USER}; # Use the NameTranslate object to convert the Display Name # of the user to the Distinguished Name. my $name_translate = Win32::OLE->new('NameTranslate') or die("Unable to load NameTranslate OLE object\n"); # Initialize NameTranslate by locating the Global Catalog. $name_translate->Init(ADS_NAME_INITTYPE_GC, ""); # Use the Set method to specify the NT of the object name. $name_translate->Set(ADS_NAME_TYPE_NT4, $nt_name); # Use the Get method to retrieve the Distinguished Name of the user. my $user_dn = $name_translate->Get(ADS_NAME_TYPE_1779); print("$nt_name => $user_dn\n");
For me, the output is
MYDOMAIN\myuser => CN=MyLast\, MyFirst,CN=Users,DC=mycompany,DC=biz
In reply to Re^3: convert the SamAccountName to the Distinguished name by using "NameTranslate"
by ikegami
in thread convert the SamAccountName to the Distinguished name by using "NameTranslate"
by SteveS832001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |