Solved

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

Posted on 2015-02-11
7
15 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
Read this checklist to learn more about the 15 things you should never include in an email signature.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

910 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

22 Experts available now in Live!

Get 1:1 Help Now