|
Hi,
Can see several have had problems with IDispatch pointers not allowed in expressions! But I've been unable to find any solutions. Here's my code:
FUNCTION mailbox($getou) $mailbox=GETOBJECT("LDAP://$getou") ? "getobj @serror" ? "User Information:" ? "Display Name: " $mailbox.get("cn") ? "Given Name: " $mailbox.get("givenname") ? "Last Name: " $mailbox.get("sn") ? "Alias: " $mailbox.get("uid")
ENDFUNCTION
FUNCTION getOU($userName)
DIM $dn,$objRootDSE,$strDomain DIM $objConnection,$objCommand DIM $objRecordSet $getOU = "Not Found" $objRootDSE = GETOBJECT("LDAP://RootDSE") $strDomain = $objRootDSE.Get("DefaultNamingContext") $objConnection = CREATEOBJECT("ADODB.Connection") $objConnection.Open ("Provider=ADsDSOObject;") $objCommand = CREATEOBJECT("ADODB.Command") $objCommand.ActiveConnection = $objConnection $objCommand.CommandText = "<LDAP://" + $strDomain + ">;((saMAccountName=" + $userName + "))" + ";distinguishedName,name;subtree"
$objRecordSet = $objCommand.Execute
WHILE Not $objRecordSet.EOF $dn = $objRecordSet.Fields("distinguishedName").Value $getOU = $dn $objRecordSet.MoveNext LOOP
mailbox($getou)
ENDFUNCTION
BREAK on
? "Enter username: " GETS $username
getOU($username)
Hope someone can help me
|