Question

Locked

Export Computer list from Active Directory

By john.anderson ·
Does anyone know of a script to export a list of computers and their descriptions from Active Directory, and export the results to excel or a csv?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Dsquery and dsget [edited2]

by Dumphrey In reply to Export Computer list from ...

will give you the data you want in 1 short batch file.

*******bat start*****

del withDesc.txt
del nameDesc.txt
dsquery computer -name * -desc * > c:\withDesc.txt
for /F %%a in (withDesc.txt) do dsget computer %%a -dn -desc >> c:\nameDesc.txt
findstr /C:"<name of domain>" c:\nameDesc.txt > sorted.txt
REM where it says <name of domain, only use the example part of example.com. This info REM should match info from your initial query.

********bat end*******

This deletes its two data files each run. It checks for computers with descriptions, and returns that list to withDesc.txt (rename at will).
The it uses this list to pull the data from AD and append the output from each query to a file nameDesc.txt.


The data will need heavy cleaning to be truly csv ready. It will create a standard pattern, so someone with data cleanup/perl skills may be able to help out more. We are small enough that my list only takes a few minutes to do by hand.

edit2: basic data clean up

Collapse -

Or if you're lazy like me....

by robo_dev In reply to Dsquery and dsget [edited ...

Just grab the whole schema with Softerra ldap browser and parse out what you need in an excel spreadsheet.

Collapse -

Not only am I azy, but cheap

by Dumphrey In reply to Or if you're lazy like me ...

(since my budget = ZERO). I have to make do with free/FOSS/built in as much as possible. I guess I could learn powershell, but I like knowing it will all be on the (windows) machine I need with no install.

Seriously, I can't even get replacement UPSs approved...

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums