Retrieving attributes from AD
Hi everybody Can anybody assist me in order to export a list of AD attributes to a textfile - preferrably a .csv file? I need these values for alle active users with an email address: Display Name All email adresses Mobile Example: User: John Doe Display Name: John Doe | Company, inc. Email Addresses: john.doe@company.com, jdoe@company.com Mobile: +1 352 123 4567 For this user, I would like a list in this form or similar: display,proxy,mobile "John Doe | Company, inc.",SMTP:john.doe@company.com;smtp:jdoe@company.com,"+1 352 123 4567"
December 1st, 2011 7:23am

UPDATE I'll appreciate a solution that will not require any 3rd party software. A one line command will be much appreciated so I don't need to involve a script :-) I've been testing CSVDE, DSQUERY and DSGET but had no luck so far. Thanks in advance!
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2011 7:36am

If you have any 2008 DC then you can run the following command on powershell open powershell on 2008 dc type : ipmo activedirectory the type :Get-ADUser -Filter * -Properties * | select name, emailaddress , mobile | Export-Csv -Path c:\users.csv change the path to your desired location.
December 1st, 2011 10:08am

Thank you very much for your reply. I need a solution that works both for for 2003 and 2008. I need this for collecting the data in order to parse them into a web application which means that I need the same format for both 2003 and 2008 domains. And IF there are any 2000 domains as well... Any suggestions?
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2011 3:27am

Hi, try ldifde utility.
December 2nd, 2011 6:00am

Actually I've tried that but didn't have any luck exporting it to a usefull format. As stated in my first post I need a format like this: display,proxy,mobile "John Doe | Company, inc.",SMTP:john.doe@company.com;smtp:jdoe@company.com,"+1 352 123 4567" The ldifde will export to a list with every entry on a new line.
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2011 8:33am

Furthermore, ldifde seems to have the DN as a mandatory field, which I don't want. If you can provide a solution to exclude the DN from the export and give it the correct format, it will work. But that's where I'm stuck at the moment.
December 2nd, 2011 8:40am

Hi Plz try the script below, it will export to C:\report.txt, dont forget to change your domain, It will provide all the users in AD whether they got smtp address or not. I suggest you can select the OU or department instead of the whole AD user ---------------------------------------------------------------------------------------------------------------- $strFilter = "(&(objectcategory=User"))" $objdomain = New-Object System.DirectoryServices.DirectoryEntry("LDAP://dc=domain,dc=com") $objSearcher = New-Object System.DirectoryServices.DirectorySearcher("LDAP://dc=domain,dc=com") $objSearcher.SearchRoot = $objdomain $objSearcher.PageSize = 10000 $objSearcher.SizeLimit = 10000 $objSearcher.Filter = $strFilter $objSearcher.SearchScope = "Subtree" $Users = $objSearher.FindAll() Foreach($user in $Users) { $property = $user.GetDirectoryEntry().properties "Name: " + $property.cn >>C:\report.txt "Display Name: " + $property.displayName >>C:\report.txt "Email Address: " + ($property.proxyAddresses | where{$_ -like "*@*"}) >>C:\report.txt "Mobile: " + $user.telephoneNumber >>C:\report.txt " " >>C:\report.txt } ---------------------------------------------------------------------------------------------------- If you would like to change OU, In LDAP part, add OU=XXXX, if you would like to select by department, do it in the strfilter Cheers Zi Feng
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2011 4:45am

Hi Plz try the PS script below, it will export to C:\report.txt, dont forget to change your domain, It will provide all the users in AD whether they got smtp address or not. I suggest you can select the OU or department instead of the whole AD user. ---------------------------------------------------------------------------------------------------------------- $strFilter = "(&(objectcategory=User"))" $objdomain = New-Object System.DirectoryServices.DirectoryEntry("LDAP://dc=domain,dc=com") $objSearcher = New-Object System.DirectoryServices.DirectorySearcher("LDAP://dc=domain,dc=com") $objSearcher.SearchRoot = $objdomain $objSearcher.PageSize = 10000 $objSearcher.SizeLimit = 10000 $objSearcher.Filter = $strFilter $objSearcher.SearchScope = "Subtree" $Users = $objSearher.FindAll() Foreach($user in $Users) { $property = $user.GetDirectoryEntry().properties "Name: " + $property.cn >>C:\report.txt "Display Name: " + $property.displayName >>C:\report.txt "Email Address: " + ($property.proxyAddresses | where{$_ -like "*@*"}) >>C:\report.txt "Mobile: " + $user.telephoneNumber >>C:\report.txt " " >>C:\report.txt } ---------------------------------------------------------------------------------------------------- If you would like to change OU, In LDAP part, add OU=XXXX, if you would like to select by department, do it in the strfilter Cheers Zi Feng
December 14th, 2011 12:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics