Solved

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

Posted on 2015-02-11
7
20 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Read this checklist to learn more about the 15 things you should never include in an email signature.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
how to add IIS SMTP to handle application/Scanner relays into office 365.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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