Active Directory and Ruby

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

Hi,

On Nov 18, 2008, at 7:24 AM, Bruno S. wrote:

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.

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

Stephen

Stephen C. wrote:

Hi,

On Nov 18, 2008, at 7:24 AM, Bruno S. wrote:

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.

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

ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]

On Tue, Nov 18, 2008 at 9:20 AM, Bruno S. [email protected] wrote:

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

Bruno S. wrote:

Stephen C. wrote:

Hi,

On Nov 18, 2008, at 7:24 AM, Bruno S. wrote:

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.

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

Aldric G. wrote:

Bruno S. wrote:

Stephen C. wrote:

Hi,

On Nov 18, 2008, at 7:24 AM, Bruno S. wrote:

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs