Solved

Export Active directory attribute for user and 3 exchange attribute in the same export

Posted on 2011-03-04
10
956 Views
Last Modified: 2012-08-13
Hi,

I need to export this attribute of AD users in csv file:

name, givenName, sn, Mail, telephoneNumber, facsimileTelephoneNumber, department, title, physicalDeliveryOfficeName, streetAdress, postOfficeBox, postalCode

In the same export, i need this 3 Exchange value:  CustomAttribute1, CustomAttribute3, CustomAttribute4

Thanks for your help.
0
Comment
Question by:cawasaki
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 3

Expert Comment

by:IamTheMorsa
ID: 35036297
Open PS

Type in this

import-module ActiveDirectory

Press Enter

Now type in this

Get-ADUser -Filter * -SearchBase "DC=YOURDOMAIN,DC=COM" -Properties * | Select-Object SamAccountName,GivenName,Surname,DisplayName,Title,mail,fax,telephonenumber,department,streetaddress,POBox,postalcode, | export-csv -path AllADUsers_v3.csv -NoTypeInformation -Encoding "UTF8"

I don't use the custom Exchange values, but you can find it by typing this:

Get-ADUser USERNAME -Properties *


0
 
LVL 13

Expert Comment

by:soostibi
ID: 35036398
Here you are, Windows Server 2008 R2 version
function str {$args}

$attribs = str name, givenName, sn, Mail, telephoneNumber, facsimileTelephoneNumber, department, title, physicalDeliveryOfficeName, streetAddress, 
    postOfficeBox, postalCode, extensionAttribute1, extensionAttribute2, extensionAttribute4
Get-ADUser -Filter * -Properties $attribs | Select-Object -Property $attribs | Export-Csv -Path c:\yourfile.csv -NoTypeInformation

Open in new window

0
 

Author Comment

by:cawasaki
ID: 35036456
Hi,

I am in Windows 2008 SP2 and Exchange 2007 sP1.

I now i can sort all this attribute with Get-ADUser, but i need to include th eexchange attribute CustomAttribute1, CustomAttribute3, CustomAttribute4.

thanks for your help
0
Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

 
LVL 13

Expert Comment

by:soostibi
ID: 35036458
Quest AD Snapin version:
function str {$args}

$attribs = str name, givenName, sn, Mail, telephoneNumber, facsimileTelephoneNumber, department, title, physicalDeliveryOfficeName, streetAddress, 
    postOfficeBox, postalCode, extensionAttribute1, extensionAttribute2, extensionAttribute4

Get-QADUser -IncludedProperties $attribs | Select-Object -Property $attribs | Export-Csv -Path c:\yourfile.csv -NoTypeInformation

Open in new window

0
 

Author Comment

by:cawasaki
ID: 35036461
and the problem when i use qet-qaduser to export extensionAttribute1, it export them blank!
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35036467
You have them in my first solution.
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35036502
And also in the Quest version.
0
 

Author Comment

by:cawasaki
ID: 35036541
Ok, quest version work, but i have 10000 user and the export stop in 1000 first user.

how i can execute this script forum unlimited user?
0
 
LVL 13

Accepted Solution

by:
soostibi earned 500 total points
ID: 35036589
Put a -SizeLimit 0  to teh Get-QADUser part:


function str {$args}  
  
$attribs = str name, givenName, sn, Mail, telephoneNumber, facsimileTelephoneNumber, department, title, physicalDeliveryOfficeName, streetAddress,   
    postOfficeBox, postalCode, extensionAttribute1, extensionAttribute2, extensionAttribute4  
  
Get-QADUser -IncludedProperties $attribs -SizeLimit 0 | Select-Object -Property $attribs | Export-Csv -Path c:\yourfile.csv -NoTypeInformation

Open in new window

0
 

Author Closing Comment

by:cawasaki
ID: 35036713
work perfectly thanks man:)
0

Featured Post

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question