Solved

Use PowerShell to extract and user/dl with specific domain

Posted on 2013-05-29
5
390 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 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
To show how to create a transport rule 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 >> Rules tab.:  To cr…
how to add IIS SMTP to handle application/Scanner relays into office 365.

689 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