![]() |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com