?
Solved

powershell check for one domain query

Posted on 2013-12-23
2
Medium Priority
?
353 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

752 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