Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Use PowerShell to extract and user/dl with specific domain

Posted on 2013-05-29
5
Medium Priority
?
394 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
[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
  • 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 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
To show how to generate a certificate request 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 Servers >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.

597 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