When you need to extract Active Directory (AD) or Windows Management Instrumentation (WMI) data, several tools are at your disposal. The Csvde command-line utility (csvde.exe) and the Scriptomatic tool (scriptomatic.exe) are both extremely useful in this respect. To get the most out of this data, you can use Microsoft Excel to format the output into clean and easy-to-read reports. Here are some scripts to show you how.
AD Reporting
Csvde, which resides in %systemroot%\system32 after you install Windows Server 2003 or Windows 2000 Server, lets you import and export AD data to a comma-separated value (CSV) file according to attribute and object filters. For example, to extract all user-object data to a .csv file called C:\report.csv, open a command window and type the following command:
csvde -f c:\report.csv -v -d
"dc=mycorp,dc=com"
-r "(objectClass=User)" -p SubTree
This command directs Csvde to extract the information to the specified file (-f), use verbose mode onscreen while running (-v), start from mycorp.com's root (-d), look for the specified objects (i.e., User objects) only (-r), and scan the whole tree (-p). If you want to extract the user objects' ADsPath property only, add the following parameter:
-l ADsPath
For more information about Csvde's syntax, use the tool's -? parameter, type the csvde command with no parameters, or go to http://www.microsoft.com/technet/prodtechnol/windowsnetserver/proddocs/entserver/csvde.asp. . . .