Active Directory and Ruby

B

Bruno Sousa

Hi everyone,
I want retrieve a list of all users from a Active Directory. How can I
do that?

I'm running this script on the AD Server.

Regards
 
B

Bruno Sousa

Stephen said:
Hi,



http://activedirectory.rubyforge.org/ seems to be a good resource.
Googled: active directory ruby.

Stephen

I've tried that:
gem install activedirectory
irb
irb(main):001:0> gem 'activedirectory'
=> true
irb(main):002:0> ActiveDirectory::Base.server_settings = {
:host => "server.example.com",
:username => "username",
:password => "password",
:domain => "example.com",
:base_dn => "DC=example,DC=com"
}

NameError: uninitialized constant ActiveDirectory
from (irb):2
from :0


I don't know what is happenning
 
A

Austin Ziegler

I've tried that:
gem install activedirectory
irb
irb(main):001:0> gem 'activedirectory'
=> true

You forgot to require 'activedirectory'.

Gem simply forces the gem's load path into the current $LOAD_PATH.

-austin
 
B

Bruno Sousa

Aldric said:
net-ldap worked very well for me.

require 'rubygems' # just in case
require 'net/ldap' # http://rubyfurnace.com/docs/ruby-net-ldap-0.0.4/
require 'pp'

ldap = Net::LDAP.new :host => "server.example.com",
:port => 389,
:auth => { :method => :simple,
:username => "username",
:password => "password" }
treebase = "dc=example,dc=dom"
filter = Net::LDAP::Filter.eq("objectCategory", "user")
ldap.search ( :base => treebase, :filter => filter) do |entry|
pp entry
end

puts ldap.get_operation_result



Thanks a lot, that was perfect.
ActiveDirectory gem was buggy, while ldap library works perfectly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top