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

x
?
Solved

powershell check for one domain query

Posted on 2013-12-23
2
Medium Priority
?
355 Views
Last Modified: 2013-12-24
Hi guys I have a command running and it locates the email address but the only thing is it grabs that email address plus everything. What I would like to do is limit the scope to only one domain in our environment.


for example we have 9 different email domains. Currentl I am using this


get-recipient -resultsize:unlimited | where {$_.emailaddresses -like "*@domain.com*" } | displayname, emailaddresses


I only want one domain.
0
Comment
Question by:techdrive
[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
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39737446
You can try this...
Get-Recipient -resultsize:unlimited | 
 where {$_.emailaddresses -match "@domain.com" } | % {
	$Name = $_.displayname
	$_.emailaddresses | where {$_ -match "@domain.com" } | 
	Select @{N="displayname";E={$Name}},@{N="emailaddresses";E={$_}}
}| Export-Csv C:\report.csv -nti

Open in new window

0
 

Author Comment

by:techdrive
ID: 39737778
thanks
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…

604 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