vbscript ldap query for office
Posted on 2011-02-16
I am familiar with programming, but am not a programmer. What I am attempting to do is use a VBScript to lookup a user (by samaccount name) and write their office (physicalDeliveryOfficeName) to a text file.
My users are spread across quite a few OU's so I know that I need to write it as a query with filters. The only portion of my script that I have pretty much "set" is the write to file. The actual LDAP portion of it I don't really have anything. I have tried modifying quite a few different scripts but something keeps going wrong - and I can't seem to extract the portion that would make what I need work (I have about 4 different not-working versions, figured rather than posting all of those I would just not post that portion of the code).
Dim Office, myFSO, WriteOffice
'Write information to Text File
office = strphysicalDeliveryOfficeName
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteOffice = myFSO.OpenTextFile("c:\temp data\efax\office.txt", 8, True)
SET WriteStuff = NOTHING
SET myFSO = NOTHING