Indyrb
asked on
Need Powershell script for Exchange 2007
I need help... Can i get assistance with creating a powershell script that can scan through exchange and kick out a csv file detailing the following information:
1 row per email received
1. User of the mailbox
2. Sender of the email
1 row per email received
1. User of the mailbox
2. Sender of the email
ASKER
Getting error on all users and no list is provided
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User1:PSObject) [Get-MessageTrackingLog], ParameterBindingEx
ception
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me ssageTrack ingLog
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User2:PSObject) [Get-MessageTrackingLog], ParameterBindingExce
ption
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me ssageTrack ingLog
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User3:PSObject) [Get-MessageTrackingLog], ParameterBindingExc
eption
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me ssageTrack ingLog
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User1:PSObject) [Get-MessageTrackingLog], ParameterBindingEx
ception
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User2:PSObject) [Get-MessageTrackingLog], ParameterBindingExce
ption
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in
put or the input and its properties do not match any of the parameters that take pipeline input.
+ CategoryInfo : InvalidArgument: (User3:PSObject) [Get-MessageTrackingLog], ParameterBindingExc
eption
+ FullyQualifiedErrorId : InputObjectNotBound,Get-Me
Give me sometime and i should be on my labs and be able to assist
- Rancy
- Rancy
Try the following command:
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID DELIVER | FL Sender, Recipients, MessageSubject | Export-Csv C:\Export.csv
Sudeep
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID DELIVER | FL Sender, Recipients, MessageSubject | Export-Csv C:\Export.csv
Sudeep
ASKER
Didn't giver user mailboxs, nor sender of the email, or subjects of emails in mailbox..
instead gave this info in the csv file.
#TYPE Microsoft.PowerShell.Comma nds.Intern al.Format. FormatStar tData
ClassId2e4f51ef21dd47e99d3 c952918aff 9cd pageHeaderEntry pageFooterEntry autosizeInfo shapeInfo groupingEntry
033ecb2bc07a4d43b5ef94ed5a 35d280 Microsoft.PowerShell.Comma nds.Intern al.Format. ListViewHe aderInfo
9e210fe47d09416682b841769c 78b8a3
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
27c87ef9bbda4f709f6b4002fa 4af63c
instead gave this info in the csv file.
#TYPE Microsoft.PowerShell.Comma
ClassId2e4f51ef21dd47e99d3
033ecb2bc07a4d43b5ef94ed5a
9e210fe47d09416682b841769c
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
27c87ef9bbda4f709f6b4002fa
The above command work flawlessly on our Exchange 2007 server. Maybe someone else would give you better idea of what's wrong.
Sudeep
Sudeep
Use Select-Object instead of Format-List (FL), FL will not pass the objects to powershell pipeline..
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID DELIVER | Select Sender, Recipients, MessageSubject | Export-Csv C:\Export.csv -NTI
ASKER
A lot better.
I take it column one is sender. However reciepent is coming up as System.String[], can we also get the date included too?
I take it column one is sender. However reciepent is coming up as System.String[], can we also get the date included too?
Try..
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID DELIVER | Select Sender,{$_. Recipients},MessageSubject,TimeStamp | Export-Csv C:\Export.csv -NTI
ASKER
Column "Recipents" still show System.String[] for each email
Also can we add the date?
Also can we add the date?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Example, this is how it is showing up
Sender Recipients MessageSubject
whitepapers@somedomain.com System.String[] Case Study
Sender Recipients MessageSubject
whitepapers@somedomain.com
Did you try with last code?
ASKER
PERFECT!!!! THANKS SO MUCH...
One last thing -- can you export the body / contents of the email into the csv file?
One last thing -- can you export the body / contents of the email into the csv file?
Which email? Are you talking about the user email? If yes, tracking log doesn't contain any information about the users email contents..
Or if you ate trying to send this command result as email then it's possible..
Or if you ate trying to send this command result as email then it's possible..
ASKER
I meant, like the example below, can you export the email\body of the message or is there anyway to get this information
Sender Recipients MessageSubject Email Message or Body Date
myjones@domain.com me@another.net Hi Hey, how is it going?
Sender Recipients MessageSubject Email Message or Body Date
myjones@domain.com me@another.net Hi Hey, how is it going?
Nope.. You cannot get the message body information with Get-MessageTrackingLog. If you want to get the message body then you need to get it from the user mailbox.. Which is not a easy task..
If you are trying to monitor user emails the best option would be using Journaling Rules..
Ref : http://www.msexchange.org/articles-tutorials/exchange-server-2007/compliance-policies-archiving/Exchange-Server-2007-Using-Journaling-Rules.html
If you are trying to monitor user emails the best option would be using Journaling Rules..
Ref : http://www.msexchange.org/articles-tutorials/exchange-server-2007/compliance-policies-archiving/Exchange-Server-2007-Using-Journaling-Rules.html
- Rancy