Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Active directory users

Hi There

I am looking for the code for a macro to be able to extract the Firstname's,
surname's and userid from our companies active directorie and put these into
an excel worksheet.

Would anybody be able to help me with this, or point me to a reference for
the syntax?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Active directory users

this article describes how to switch lastname and firstname (usng windows
scripting host), so you could probably skip the PUT part and it should be a
start:

http://support.microsoft.com/default...b;en-us;277717
How to Change the Display Names of Active Directory Users with Active
Directory Services Interface Script

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I am looking for the code for a macro to be able to extract the

Firstname's,
surname's and userid from our companies active directorie and put these

into
an excel worksheet.

Would anybody be able to help me with this, or point me to a reference for
the syntax?

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Active directory users


or have a look at following.

How To Use ADO to Access Objects Through an ADSI LDAP Provider
http://support.microsoft.com?kbid=187529

I cant test it here... but it could look like this?

Sub LDAPviaADO()
Dim rs As Object

With CreateObject("ADODB.Connection")
.Provider = "ADSDSOObject"
.Open "ADs Provider"
'EDIT THE FOLLOWING STRING for correct settings!
Set rs = .Execute( _
"<LDAP://server/o=organization/ou=site/cn=recipients;" _
& "(objectClass=*);ADsPath,objectClass,cn;subtre e")

ActiveSheet.Cells(1).CopyFromRecordset rs
rs.Close
.Close
End With

End Sub

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Tom Ogilvy" wrote:

this article describes how to switch lastname and firstname (usng
windows scripting host), so you could probably skip the PUT part and
it should be a start:

http://support.microsoft.com/default...b;en-us;277717
How to Change the Display Names of Active Directory Users with Active
Directory Services Interface Script


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Active directory users

Hi There

I tried to follow the article posted, but I am still hitting a problem

this is my code

Set oTargetOU = GetObject("LDAP://DC=topics.co.za")

x = 1

oTargetOU.Filter = Array("user")

For Each usr In oTargetOU

If InStr(usr.SamAccountName, "$") = 0 Then
Cells(x, 1) = usr.get("Sn")
Cells(x, 2) = usr.get("GivenName")
x = x + 1
End If
Next

It falls over on the first line with the message:
a referral was returned from the server
Is there something wrong with my syntax or am I missing a reference
somewhere?

"Tom Ogilvy" wrote in message
...
this article describes how to switch lastname and firstname (usng windows
scripting host), so you could probably skip the PUT part and it should be
a
start:

http://support.microsoft.com/default...b;en-us;277717
How to Change the Display Names of Active Directory Users with Active
Directory Services Interface Script

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I am looking for the code for a macro to be able to extract the

Firstname's,
surname's and userid from our companies active directorie and put these

into
an excel worksheet.

Would anybody be able to help me with this, or point me to a reference
for
the syntax?

Thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Active directory users

I am afraid I personally know little about Active Directory. This article
shows what to reference and what the name of the help file is - where you
should be able to get some of the information you need.

http://support.microsoft.com/default...b;en-us;194115
How To Use ADSI in VB to Enumerate the Computers in an NT Domain

ADSI Help file (ADSI.HLP)
In the ADSI Help file Contents, choose Guide - Introduction to Active
Directory Service Interfaces - Code Examples - Automation examples and
ADsPaths examples for more Visual Basic code examples.

The reference would be set to
ActiveDS

(the type library file is ActiveDS.tlb)
The Active DS Type Library provides the ADSI object model.

It has a link to these if it isn't installed on your machine.

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I tried to follow the article posted, but I am still hitting a problem

this is my code

Set oTargetOU = GetObject("LDAP://DC=topics.co.za")

x = 1

oTargetOU.Filter = Array("user")

For Each usr In oTargetOU

If InStr(usr.SamAccountName, "$") = 0 Then
Cells(x, 1) = usr.get("Sn")
Cells(x, 2) = usr.get("GivenName")
x = x + 1
End If
Next

It falls over on the first line with the message:
a referral was returned from the server
Is there something wrong with my syntax or am I missing a reference
somewhere?

"Tom Ogilvy" wrote in message
...
this article describes how to switch lastname and firstname (usng

windows
scripting host), so you could probably skip the PUT part and it should

be
a
start:

http://support.microsoft.com/default...b;en-us;277717
How to Change the Display Names of Active Directory Users with Active
Directory Services Interface Script

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I am looking for the code for a macro to be able to extract the

Firstname's,
surname's and userid from our companies active directorie and put these

into
an excel worksheet.

Would anybody be able to help me with this, or point me to a reference
for
the syntax?

Thanks










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Active directory users

Thanks
It's working now

"Tom Ogilvy" wrote in message
...
I am afraid I personally know little about Active Directory. This article
shows what to reference and what the name of the help file is - where you
should be able to get some of the information you need.

http://support.microsoft.com/default...b;en-us;194115
How To Use ADSI in VB to Enumerate the Computers in an NT Domain

ADSI Help file (ADSI.HLP)
In the ADSI Help file Contents, choose Guide - Introduction to Active
Directory Service Interfaces - Code Examples - Automation examples and
ADsPaths examples for more Visual Basic code examples.

The reference would be set to
ActiveDS

(the type library file is ActiveDS.tlb)
The Active DS Type Library provides the ADSI object model.

It has a link to these if it isn't installed on your machine.

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I tried to follow the article posted, but I am still hitting a problem

this is my code

Set oTargetOU = GetObject("LDAP://DC=topics.co.za")

x = 1

oTargetOU.Filter = Array("user")

For Each usr In oTargetOU

If InStr(usr.SamAccountName, "$") = 0 Then
Cells(x, 1) = usr.get("Sn")
Cells(x, 2) = usr.get("GivenName")
x = x + 1
End If
Next

It falls over on the first line with the message:
a referral was returned from the server
Is there something wrong with my syntax or am I missing a reference
somewhere?

"Tom Ogilvy" wrote in message
...
this article describes how to switch lastname and firstname (usng

windows
scripting host), so you could probably skip the PUT part and it should

be
a
start:

http://support.microsoft.com/default...b;en-us;277717
How to Change the Display Names of Active Directory Users with Active
Directory Services Interface Script

--
Regards,
Tom Ogilvy


"Dr Alric" wrote in message
...
Hi There

I am looking for the code for a macro to be able to extract the
Firstname's,
surname's and userid from our companies active directorie and put
these
into
an excel worksheet.

Would anybody be able to help me with this, or point me to a reference
for
the syntax?

Thanks










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel and Active Directory javagirl Excel Discussion (Misc queries) 2 March 30th 07 05:04 PM
Excel active directory James Setting up and Configuration of Excel 0 April 6th 05 09:00 PM
active directory? Tim[_39_] Excel Programming 0 August 15th 04 08:34 AM
Active Directory Ulf Nilsson Excel Programming 2 April 27th 04 07:08 AM


All times are GMT +1. The time now is 01:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"