Solved

Need some tips using Powershell to analysis the screen output of Exchange message logs

Posted on 2015-02-11
7
11 Views
Last Modified: 2016-06-23
I would like some tips on how to use  PowerShell to extract data, I'm using Exchange message logs as example but could apply to anything:

So I'll try explain what I'd like to do:

1. Firstly run a command like $search = Get-MessagingTrackingLog -Server xxxxxx
2. Whilst the viewing the output on screen, I like to stop at a line, and run $search [x] | fl

Any help would be appreciated and thank you in advance
0
Comment
Question by:mandalj
  • 3
  • 2
7 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 40604888
2. Whilst the viewing the output on screen, I like to stop at a line, and run $search [x] | fl

Do not really understand the second question. Please rephrase.

Will.
0
 

Author Comment

by:mandalj
ID: 40604936
Sorry, not the easiest thing to explain. I've attached a couple of screen shots, hope it helps.

Thanks.
EE-Question.docx
0
 
LVL 13

Expert Comment

by:Guy Lidbetter
ID: 40605185
OK, to follow what you are asking...

In your example you take a tracking log and put it into a variable, you would then want to be able to pick any line out of display  and format list for all details?

If that is the case, if the log had hundreds (if not thousands) of lines, half way down you would have no idea what the line number is, so you need to add those to the output for the variable array.

Am I on the right track?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:mandalj
ID: 40605373
Yes, you are.
0
 
LVL 13

Accepted Solution

by:
Guy Lidbetter earned 500 total points
ID: 40607588
Hi Mandalj,

So I've been playing with this and needs a little more work, but this is where I am so far...

To insert the line number run the below which will update the $Search Array

"
[decimal]$LineNumber = 0
$Search = Get-TransportServer | Get-MessageTrackingLog -start "11/02/2015 09:00:00" -End "11/02/2015 09:05:00"
ForEach ($Line in $Search) {
    $Line | Add-Member -Name "Line" -Type NoteProperty -Value $LineNumber
    $LineNumber ++
    }
"

If you then run a select with the initial columns you would like to see, i.e.

$Search | Format-Table -Autosize Line, EvenID, Source, Sender, Recipients | More

You can go a page at a time, break (CTRL +C), then run

$Search[x] | FL

For all the details.

Not glamorous... but it works

Cheers

Guy
0
 

Author Comment

by:mandalj
ID: 40610308
Thanks Guy...I'll try this out.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
The purpose of this video is to demonstrate how to set up an account with Mailchimp. This will be demonstrated using a Windows 8 PC. Tools Used are: Mailchimp.com Go to Mailchimp.com : Enter an Email, Username, and Password. Click Create My Acco…
This Micro Tutorial demonstrates  how Internet marketers work with competitive analysis data, and a common task in data preparation is creating separate column for domains. You will then extract from a list of URLs.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now