Solved

Exchange 2010  user query

Posted on 2013-01-03
4
283 Views
Last Modified: 2013-02-04
Hi,
I need to run a query (I'm guessing in powershell) that will give me a list of my email users and their email addresses.
I did some searching online and came up with this:
get-recipient | where {$_.emailaddresses -match "mydomain.com"}  | select Firstname, emailaddresses

This query works to a degree. But I have a few questions:
1. Regarding the fields I am  using the select on (Firstname, emailaddresses). Where can I find a list of field names that I can query against.
2. How to I export the results of this query to a text file?

Thanks!
M
0
Comment
Question by:nachtmsk
4 Comments
 
LVL 42

Expert Comment

by:Amit
ID: 38740147
Ya PS can do it, why don't you first try with EMC and export the result.
0
 
LVL 52

Expert Comment

by:Manpreet SIngh Khatra
ID: 38740185
1.)
Get-Recipient "Username" | FL
Get-Mailbox "Username" | FL
Get-User "Username" | FL

2.)
At the last use > c:\user.txt

- Rancy
0
 
LVL 23

Accepted Solution

by:
Stelian Stan earned 400 total points
ID: 38740194
to find the list with all the name fields just run:
Get-Recipient -Identity testuser | fl

to export:
get-recipient | where {$_.emailaddresses -match "mydomain.com"}  | select Firstname, emailaddresses | Export-CSV C:\Temp\test.csv
0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 100 total points
ID: 38740405
You may have to add -ResultSize Unlimited to search all users, by default search will include only 1000 recipient objects (If you have less that 1000 recipient objects in your AD then it's not necessary)

Also select * will give you all properties to export. You can also select each properties as mentioned in above posts..

Get-Recipient -ResultSize Unlimited | where {$_.emailaddresses -match "mydomain.com"}  | select * | Export-CSV c:\result.csv

Open in new window


emailaddresses is a multivalued property so you need to use Select {$_.emailaddresses} to view the correct result while exporting..
Get-Recipient -ResultSize Unlimited | where {$_.emailaddresses -match "mydomain.com"}  | select Firstname,{$_.emailaddresses} | Export-CSV C:\result.csv

Open in new window

Get-Recipient UserA | GM | ?{$_.Membertype -eq "Property"} will also show you the properties which you can select..
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Read this checklist to learn more about the 15 things you should never include in an email signature.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

773 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