Solved

Use PowerShell to extract and user/dl with specific domain

Posted on 2013-05-29
5
386 Views
Last Modified: 2013-05-29
Hello All,
I'm trying to find a way to extract users and groups with a specific email address (ie, @abc.com) and save it as an excel file.

someone asked me for all users and DL's ending in a sepecific domain email address. We receive email from a few domains and in AD i dont see an easy way to do that.

i was hoping EMS would be able to do this.
0
Comment
Question by:msidnam
  • 4
5 Comments
 
LVL 14

Expert Comment

by:Ben Hart
ID: 39204906
0
 
LVL 14

Expert Comment

by:Ben Hart
ID: 39204919
wait hold on.. thats not right..
0
 
LVL 14

Expert Comment

by:Ben Hart
ID: 39204924
get-recipient -ResultSize unlimited | where {$_.emailaddresses -match “test.local“} | select name,emailaddresses > c:\out.txt
0
 
LVL 14

Expert Comment

by:Ben Hart
ID: 39204926
Or maybe better..

Get-Mailbox -resultsize unlimited | Select-Object displayname -expandproperty emailaddresses| Where-Object {$_.smtpaddress -like "*domain.com*"}| Select-Object displayName,SmtpAddress | Export-csv C:\domain.csv
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39205022
You need to filter the groups and User mailboxes from Get-recipient command output.. For example..
Get-recipient -ResultSize unlimited | ?{($_.RecipientType -match "Group" -or $_.RecipientType -eq "UserMailbox") -and $_.emailaddresses -match "Test.com"} | Export-Csv C:\report.csv -NTI

Open in new window

0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
A procedure for exporting installed hotfix details of remote computers using powershell
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
how to add IIS SMTP to handle application/Scanner relays into office 365.

770 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