?
Solved

powershell placing get-content for custom list rather than command

Posted on 2014-08-06
7
Medium Priority
?
237 Views
Last Modified: 2014-08-27
I have a list of distribution lists rather than trying to scan our entire enterprise. Can anyone tell me the best way to implement get-content with a csv for a custom list to be ran against these commands rather than running for a certain group or all groups. thanks


Get-MessageTrackingLog -EventID Expand | ? {$_.RelatedRecipientAddress -like "DG-Marketing@MyDomain.com"} | ft Timestamp,Sender,MessageSubject -Autosize


Get-MessageTrackingLog -Server EXCH1 -EventId Expand -ResultSize Unlimited | Sort-Object RelatedRecipientAddress | Group-Object RelatedRecipientAddress | Sort-Object Name | Select-Object @{label="PrimarySmtpAddress";expression={$_.Name}}, Count
0
Comment
Question by:techdrive
  • 4
  • 3
7 Comments
 
LVL 41

Expert Comment

by:footech
ID: 40245319
Get-Content is used for text files, while Import-CSV is for .CSV files.  While technically .CSVs are text files, they are formatted in a specific fashion, so it's important to differentiate between a .CSV and plain text file that just has one element per line.

I think you're looking for something like this.
$DGs = Get-Content list.txt
Get-MessageTrackingLog -EventID Expand | ? { $DGs -contains $_.RelatedRecipientAddress } | ft Timestamp,Sender,MessageSubject -Autosize

Open in new window

0
 

Author Comment

by:techdrive
ID: 40245587
awesome thanks
0
 

Author Comment

by:techdrive
ID: 40253417
hey I am not getting any data when I run this command this way. Its not returning anything and I know some of these groups received email in the last 30 days,
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 41

Expert Comment

by:footech
ID: 40254619
Sorry, but I won't be able to troubleshoot as I don't have access to the right environment.  Maybe I can see an issue if you provide the output from
Get-MessageTrackingLog -EventID Expand | gm
# and maybe
Get-MessageTrackingLog -EventID Expand | ? {$_.RelatedRecipientAddress -like "DG-Marketing@MyDomain.com"}

Open in new window

I need to see what the RelatedRecipientAddress property is like.
0
 

Author Comment

by:techdrive
ID: 40276709
still no answer
0
 
LVL 41

Accepted Solution

by:
footech earned 1500 total points
ID: 40278043
You haven't provided any more info.
If you want you can click the Request Attention button to try to get some other expert's input.
0
 

Author Comment

by:techdrive
ID: 40288569
dont worry I was able to resolve
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this video we show how to create an email address policy 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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

864 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