From: Francis Cianfrocca Date: 2007-02-03T08:43:04+09:00 Subject: Re: net::ldap - add_attribute ------=_Part_20104_353958.1170459782586 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/2/07, Rcmn 73 wrote: > > i'm trying to add a workstation "monnomdemachine" to a group "mygroup" > > but i get "#" > > > require 'net/ldap' > > # look up Machine to ProdWindowsXPWorkstations > ldap = Net::LDAP.new :host => '11111111', > :port => 389, > :auth => { > :method => :simple, > :username => > "cn=user,ou=ou0,ou=ou1,ou=ou3,dc=dc,dc=dc1,dc=net", > :password => "pass" > } > > filter = Net::LDAP::Filter.eq( "cn", "monnomdemachine" ) > treebase = "dc=dc,dc=dc1,dc=net" > > ldap.search( :base => treebase, :filter => filter ) do |entry| > $dnwks = "DN: #{entry.dn}" > end > > gr = "CN=mygoupe,OU=uu2,OU=uu1,OU=uu,dc=dc,dc=dc1,dc=net" > ldap.add_attribute gr, :member, $dnwks > > p ldap.get_operation_result > > -- > Posted via http://www.ruby-forum.com/. > > Looks like you gave the parameters to Net::LDAP#add_attribute in the wrong order. By the way, you don't have to give a block to Net::LDAP#search if you prefer not to. It will return an array of the returned objects. ------=_Part_20104_353958.1170459782586--