Solved

powershell check for one domain query

Posted on 2013-12-23
2
351 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 500 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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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