Monday, May 14, 2012

Preparing scripts for Exporting details from active directory or Exchange

Observed many of my colleagues looking for ready  scripts  in internet for exporting details from AD / Exchange.
Infact its very easy using cmdlets / AD query etc. If you know little bit of excel vlookup / pivot table  you can do comparisons / appending etc easily on output files.

Eg: If you want to export any attributes of objects ( here users ), you can use any of below.
1. AD query ( in AD users & computers) ( eg: you can go for User with business phone present., right click on results & do add /remove columns to add required fields, select all & export to csv)
2. csvde -d "DC=domainname,DC=COM" -f result.csv -r “(&(objectClass=user)(objectCategory=person)” -l "list of attributes seperated in comma "
3. dsquery  / dsget user commands
4. Powershell ( cmdlets like Get-user OR Get-mailbox  etc )