Title: Message

Now how do you get this to work into a multiple value attribute like ‘proxyAddresses I suppose you build an array and then parse out lines that don’t start w/ SMTP:?  Anyone have a script that’ll do this?

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mulnick, Al
Sent: Friday, January 09, 2004 3:32 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] ldifde and/or csdve

 

Mark's script should do what you're after and if you change the "|" to "," you get a CSV file :)

 

If you are still bent on using CSVDE, you'll have to change your query to include the "mail" objectClass so you can see only one SMTP address.  You get many, because users have many and there's no reason to expect otherwise. 

The one you have is a default, "give me everything in this OU" command. I believe it's a -r option in the csvde command (not near one, so check the help) then you'd set (|(objectCategory=Person)(objectCategory=mail)) as part of your filter.  You're looking for all user objects with a mail attribute of * in the OU you specified.

Csvde -f GAlSync.csv -d "OU=Contacts,OU=whatever,DC=CORP,DC=companyname,DC=com

 


From: Creamer, Mark [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 2:41 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] ldifde and/or csdve

Travis, the following should query your GC and return a | (pipe) delimited text file with a few attributes including "mail." Have a look to see if that's what you want. This is adapted from scripts found elsewhere, created by folks smarter than me ;-) YMMV

 

Change the dc=myRootDomain to the appropriate root in your environment, and watch for line wraps in the code.

 

 

Dim strLogFile

strLogFile = "c:\temp\user_location.txt"

 

Set fso = CreateObject("Scripting.FileSystemObject")

Set objFile = fso.CreateTextFile(strLogFile, 8, True)

 

Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open "Provider=ADsDSOObject;"

 

Set objCommand = CreateObject("ADODB.Command")

objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000

objCommand.Properties("Sort On") = "sAMAccountName"

objCommand.Properties("Time Limit")      = 0

objCommand.Properties("Timeout")         = 0

 

 

objCommand.CommandText = _

 "<GC://dc=myRootDomain,dc=com>;" & _

      "(&(objectCategory=person)(objectClass=user));" & _

          "sAMAccountName,sn,givenName,mail;subtree"

 

Set objRecordSet = objCommand.Execute

 

While Not objRecordset.EOF

            objFile.Writeline objRecordset.Fields("sAMAccountName").Value & "|" & objRecordset.Fields("sn").Value & "|" & objRecordset.Fields("givenName").Value & "|" & objRecordset.Fields("mail").Value

    objRecordset.MoveNext

Wend

 

objConnection.Close

 

MsgBox "Query has completed. You may view the file c:\temp\user_attribs.txt."

 

 

<mc>

 

Reply via email to