Pulling AD Properties for a spreadsheet of users?

  • Thread starter Thread starter rob
  • Start date Start date
R

rob

I am looking for a way to retrieve information from AD. I want to have
a spreadsheet with 1 column where I can put the SAMAccountName, and
then have the script pull homeDirectory and homeMDB values from those
user accounts, dumping it into that or another spreadsheet. That way
it will be a whole lot quicker generating the info I need to put into
other, pre-built scripts that I don’t know enough to edit yet. I
have to retrieve these two values 100s of times a day and I’d much
rather do it just the once.

All of the information I have found so far is just for creating
accounts, or for pulling these bits of information for a single user
and displaying it in a web page or dialog box. I am not yet
knowledgable enough to adapt these lessons learned yet. ïŠ I also
could dump all 13K users from my OU with csvde and search for my
values, but that still take a long time to cull the excess users, much
less sort them how I need them.

Thanks in advance for any help!

Robert
 
http://www.microsoft.com/technet/scriptcenter/scripts/office/excel/ofexvb05.mspx


I am looking for a way to retrieve information from AD. I want to have
a spreadsheet with 1 column where I can put the SAMAccountName, and
then have the script pull homeDirectory and homeMDB values from those
user accounts, dumping it into that or another spreadsheet. That way
it will be a whole lot quicker generating the info I need to put into
other, pre-built scripts that I don't know enough to edit yet. I
have to retrieve these two values 100s of times a day and I'd much
rather do it just the once.

All of the information I have found so far is just for creating
accounts, or for pulling these bits of information for a single user
and displaying it in a web page or dialog box. I am not yet
knowledgable enough to adapt these lessons learned yet. ? I also
could dump all 13K users from my OU with csvde and search for my
values, but that still take a long time to cull the excess users, much
less sort them how I need them.

Thanks in advance for any help!

Robert
 
That was a great help, thanks! I was even able to modify it for the
info I wanted without too much trouble.

Is there a way to grab input from a spreadsheet for that script? I
don't want all my users, but only a specified list -- not from a query,
just a list. I've seen examples, but they all relate to creating
users, not simply reading the data and dumping it to the sheet. I'm
not knowledgable enough to know specifically the code parts I need and
what I don't.
 
You could use some of the code in this script to do what you want:
http://www.microsoft.com/technet/scriptcenter/scripts/office/excel/ofexvb03.mspx


I haven't tested this, but it should give you an idea:

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("C:\Scripts\New_users.xls")

intRow = 2

Do Until objExcel.Cells(intRow,1).Value = ""
Set objOUser = GetObject("cn=" & objExcel.Cells(intRow, 1).Value & _
",ou=Finance, dc=fabrikam, dc=com")
' Put the XLS export code from the other script here (or in a subroutine)
intRow = intRow + 1
Loop

objExcel.Quit
 
Back
Top