You really can't do much with Win32::Lanman and AD, as you are only really using NT funtion to achieve what you want, so there's no control over anything purely Win2K/AD related. You really need to use Win32::OLE to do what you're trying to. Here are a couple of user modification sibroutintes that I use;
sub ad_modify { # To change a single value in AD
use Win32::OLE;
my $dn = $_[0]; # The object DN
my $attrib = $_[1]; # The attribute to change
my $value = $_[2]; # The attributes new value
my ($object);
$object = Win32::OLE->GetObject("$dn");
$object->{$attrib} = "$value";
$object->SetInfo; # Don't forget to set the values
}
sub ad_get_attrib { # For returning Attribute Values....
use Win32::OLE;
my $dn = $_[0]; # The object DN
my $attrib = $_[1]; # The attribute in question
my ($object,$result);
$object = Win32::OLE->GetObject("$dn");
if ($object->{$attrib}) { # If this Attribute actually exists....
$result = $object->Get("$attrib");
}
return $result;
}
sub ad_search { # To search AD and return a pre-determined value
use Win32::OLE;
my $search_base = $_[0]; # This is the base for our searches
my $filter = $_[1]; # This is the valid LDAP filter that we will be ap
+plying
my $attribute = $_[2]; # This is the attribute that we will be returni
+ng
my $search_scope = $_[3]; # This is the scope for our search to follow
my ($conn, $res, @result, $succ_search); # Variables that we are using
+ as we go
$conn = Win32::OLE->new('ADODB.Connection'); # New connection
$conn->{Provider} = "ADsDSOObject"; # OLE provider
$conn->Open;
$res = $conn->Execute($search_base . $filter . $attribute . $search_sc
+ope); # This is our search
if ($res->EOF) { # If we have found 0 records that match our search
$succ_search = 0; # Set our no records found item and return it
} else {
$succ_search = 1; # So our records found item
$res->MoveFirst; # Go to the first record
while (not $res->EOF) { # Whie we still have records
push (@result, $res->Fields(0)->Value); # Push them to our arr
+ay
$res->MoveNext; # Go to the next one
}
}
return ($succ_search, @result); # Return our success and our array of
+results
}
You could use a mix of Win32::OLE and Win32::Lanman::NewUser to achieve that you want (Win32::OLE will also allow you to move objects to new containers), but I'd suggest doing a bit of research and using Win32::OLE to do the whole lot.