exodius Posted June 16, 2006 Share Posted June 16, 2006 I'm trying to get this script below, which I borrowed/stole from here to work.. but I'm not sure where I need to change the settings to work specifically for our ldap setup.Our specifics are:Hostname = "ldap.iastate.edu"Port = "389"Search Options = "dc=iastate,dc=edu"expandcollapse popup;Script Options autoitsetoption("trayiconhide", 1) #include <GUIConstants.au3> #include<constants.au3> opt("GUIDataSeparatorChar", Chr('13')) ;Creation of GUI GUICreate("Employee Contact Information App", 400,400) ;Search, list and TAB GUICtrlCreateLabel("Employee last name:",20,16) $name1=GUICtrlCreateInput("",20,30,100,"") $search=GUICtrlCreateButton("Search",70,55,50,"",$BS_DEFPUSHBUTTON) GUICtrlCreateLabel("Results:",130,16) $list=GUICtrlCreateList("",130,30,160,75,-1) $edit=GUICtrlCreateButton(" Edit Info ",295,65,70,22) ;Close button $close=guictrlcreatebutton(" Close ",321,360) ;General Information guictrlcreatetab(15,100,370,250) GUICtrlCreatetabitem(" General Info ") guictrlcreatelabel("Description",25,130) $desc=GUICtrlCreateinput("",25,145,200,20,-1) guictrlcreatelabel("Office",25,170) $office=GUICtrlCreateinput("",25,185,200,20,-1) guictrlcreatelabel("Telephone",25,210) $tel=GUICtrlCreateinput("",25,225,200,20,-1) ;Address Information ;guictrlcreatetabitem(" Address Info ") ;guictrlcreatelabel("Street",25,130) ;guictrlcreateedit("",25,145,155,40,Bitor($ES_WANTRETURN,$WS_VSCROLL,$ES_MULTILINE)) ;guictrlcreatelabel("P.O. Box",25,190) ;guictrlcreateinput("",25,205,155,20,-1) ;guictrlcreatelabel("City",25,230) ;guictrlcreateinput("",25,245,155,20,-1) ;guictrlcreatelabel("State/Province",25,265) ;guictrlcreateinput("",25,280,155,20,-1) ;guictrlcreatelabel("Zip/Postal Code",200,265) ;guictrlcreateinput("",200,280,155,20,-1) ;guictrlcreatelabel("Country/region",25,300) ;GUICtrlCreateCombo("",25,315,155,20,-1) ;Telephones Information GUICtrlCreateTabItem(" Telephones ") guictrlcreatelabel("Home",25,130) $hometel=GUICtrlCreateinput("",25,145,200,20,-1) guictrlcreatelabel("Mobile",25,170) $mobile=GUICtrlCreateinput("",25,185,200,20,-1) guictrlcreatelabel("Fax",25,210) $fax=GUICtrlCreateinput("",25,225,200,20,-1) ;Organization Information Guictrlcreatetabitem(" Organization ") guictrlcreatelabel("Title",25,130) $title=GUICtrlCreateinput("",25,145,200,20,-1) guictrlcreatelabel("Department",25,170) $dept=GUICtrlCreateinput("",25,185,200,20,-1) guictrlcreatelabel("Company",25,210) $company=GUICtrlCreateinput("",25,225,200,20,-1) ;Show Application Window GUISetState(@SW_SHOW) ;Actions while 1 $msg=GUIGetMsg() Dim $input Dim $PID $objConnection = ObjCreate("ADODB.Connection") $objConnection.Open ("Provider=ADsDSOObject;") $objCommand = ObjCreate("ADODB.Command") $objCommand.ActiveConnection = $objConnection Select Case $msg=$search ProgressOn("Please Wait","Searching...","0 percent") guictrlsetdata($list, "") ProgressSet( 10, "10 percent") $PID=Run(@comspec & " /c" & " dsquery user -name " & guictrlread($name1) & "* " & "-o rdn -limit 1000", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProgressSet( 20, "20 percent") sleep(1000) ProgressSet( 60, "60 percent") $input=stdoutread($PID) ProgressSet( 70, "70 percent") $strip=stringreplace($input,chr(10),"") ProgressSet( 80, "80 percent") $strip2=stringreplace($strip,'"',"") ProgressSet( 90, "90 percent") guictrlsetdata($list, $strip2 ) ProgressSet( 100, "100 percent") sleep(100) progressoff() case $msg=$edit $objCommand.CommandText = "<LDAP://dc=iastate,dc=edu>;(&(objectCategory=User)(displayName="&guictrlread($list)&"));Company, Department;subtree" $objRecordSet = $objCommand.Execute if $objRecordSet.RecordCount = 0 then MsgBox(0,"","Not Found!") else guictrlsetdata($company, $objRecordSet.Fields("Company").Value) guictrlsetdata($office, $objRecordSet.Fields("Office").Value) EndIf Case $msg=$GUI_EVENT_CLOSE ExitLoop Case $msg=$close ExitLoop EndSelect wend $objConnection.Close() Link to comment Share on other sites More sharing options...
Developers Jos Posted June 16, 2006 Developers Share Posted June 16, 2006 are you using the exact user's display name or do you want to search for the name beginning with ?If that is the case you need an asterix:$objCommand.CommandText = "<LDAP://dc=iastate,dc=edu>;(&(objectCategory=User)(displayName="&guictrlread($list)&"*));Company, Department;subtree" SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now