I was given a list of over three thousand users, I needed to get the first
and last name, samaccountname, and the office information from each account.
I may be going about this the wrong way, but I'm not a scripter so I don't
know how to do this with vbscript.
Using Excel and DSQuery, I was able to put together a file where I ran
dsquery against all of the users in the list I was given. This gave me the
full common name of each user.
Then using this list and excel, I put together a file where using CSVDE, I
was able to query AD for each user listing the above mentioned attributes as
output data.
The problem is, when I run the first query, it outputs the data to the
output file I have listed in the CSVDE query.
When I run the second query, I want to use the same output file and have it
append the information of the second user. I want to do this for all three
thousand users so when it's done, I'll have one file with all the information
for all the users.
Unfortunately, when I run the second query, the file I created in the first
query is overwritten by the information from the second query. So if I were
to run this command all the way through, it would query for three thousand
users, but it would only list the information for the last user queried.
Is there a way I can get it to append, or perhaps there is an easier way for
me to approach this?
Thanks
"Howard Goldstein" <HowardG...@discussions.microsoft.com> wrote in
message news:798F372B-59D9-438C...@microsoft.com...
> Hi I've got a question concerning CSVDE and the output file it creates.
>
> I was given a list of over three thousand users, I needed to get the first
> and last name, samaccountname, and the office information from each
> account.
>
> I may be going about this the wrong way, but I'm not a scripter so I don't
> know how to do this with vbscript.
>
> Using Excel and DSQuery, I was able to put together a file where I ran
> dsquery against all of the users in the list I was given. This gave me
> the
> full common name of each user.
>
> Then using this list and excel, I put together a file where using CSVDE, I
> was able to query AD for each user listing the above mentioned attributes
> as
> output data.
>
> The problem is, when I run the first query, it outputs the data to the
> output file I have listed in the CSVDE query.
>
> When I run the second query, I want to use the same output file and have
> it
> append the information of the second user. I want to do this for all
> three
> thousand users so when it's done, I'll have one file with all the
> information
> for all the users.
you could do the output to a temp file and then append it to another file...
> Unfortunately, when I run the second query, the file I created in the
> first
> query is overwritten by the information from the second query. So if I
> were
> to run this command all the way through, it would query for three thousand
> users, but it would only list the information for the last user queried.
>
> Is there a way I can get it to append, or perhaps there is an easier way
> for
> me to approach this?
I would tend to avoid dsquery and run csvde against the domain to list those
attributes for all accounts. If there are way more accounts than the ones I
was interested in, i'd consider the following possible alternatives:
- a batch file that would read through the csvde output file looking for the
three-thousand of interest, and write their records to a separate file
- a vbscript that would read through the account list file, make ADSI calls
to get the attributes of interest, and write that to an output file.
- if there were an attribute available for your use, you might be able to
use dsquery and dsput to store a special token there, and then do a move
complex csvde query of all accounts having that value in that attribute.
/Al