As everyone else, I am completely new to Powershell, but I hope some of you guys can help me out with my issue
have been trying to get powershell to make me a CSV file with all entries in the messagetrackinglog of the type FAIL. But I am having some problems with the two of the variables - Recipients and SenderRecipients.
The commandline I am trying to run is this:
get-messagetrackinglog -EventID "FAIL" -Start "07-07-2007 00:00:00" -End "07-07-2007 23:59:00" -ResultSize 4 | Select-Object Recipients, SenderRecipients, RecipientStatus, ServerIp,Sender, MessageId | export-csv c:\test.csv
And the file I get from this is this:
#TYPE System.Management.Automation.PSCustomObject
Recipients,SenderRecipients,RecipientStatus,ServerIp,Sender,MessageId
System.String[],,System.String[],,henrik@kanonerbjudande.se,<419779-22007745104938156@mailsenderclass>
System.String[],,System.String[],,henrik@kanonerbjudande.se,<4133288-22007745151252296@mailsenderclass>
System.String[],,System.String[],,fyb@zianet.com,<468E8C31.6060202@zianet.com>
System.String[],,System.String[],216.234.192.171,postmaster@mailsender.biz,<75f85890-ac52-44db-b585-133bc37e3618>
As you can see, Recipients and SenderRecipients are of an array type, and does not give me the content.
My question is therefore, how can I get the information in the two arrays? If this is not the right forum to ask for help with powershell, I apologize, and hope someone can point me to a more suitable forum to seek help.
Eventually I want this command/script to run daily via a scheduled job somehow. I gather that I need to make a ps1 script that can be run by windows. If the above command needs to be altered to make this possible, I would also very much like to get input on this
Hope someone can help.
have been trying to get powershell to make me a CSV file with all entries in the messagetrackinglog of the type FAIL. But I am having some problems with the two of the variables - Recipients and SenderRecipients.
The commandline I am trying to run is this:
get-messagetrackinglog -EventID "FAIL" -Start "07-07-2007 00:00:00" -End "07-07-2007 23:59:00" -ResultSize 4 | Select-Object Recipients, SenderRecipients, RecipientStatus, ServerIp,Sender, MessageId | export-csv c:\test.csv
And the file I get from this is this:
#TYPE System.Management.Automation.PSCustomObject
Recipients,SenderRecipients,RecipientStatus,ServerIp,Sender,MessageId
System.String[],,System.String[],,henrik@kanonerbjudande.se,<419779-22007745104938156@mailsenderclass>
System.String[],,System.String[],,henrik@kanonerbjudande.se,<4133288-22007745151252296@mailsenderclass>
System.String[],,System.String[],,fyb@zianet.com,<468E8C31.6060202@zianet.com>
System.String[],,System.String[],216.234.192.171,postmaster@mailsender.biz,<75f85890-ac52-44db-b585-133bc37e3618>
As you can see, Recipients and SenderRecipients are of an array type, and does not give me the content.
My question is therefore, how can I get the information in the two arrays? If this is not the right forum to ask for help with powershell, I apologize, and hope someone can point me to a more suitable forum to seek help.
Eventually I want this command/script to run daily via a scheduled job somehow. I gather that I need to make a ps1 script that can be run by windows. If the above command needs to be altered to make this possible, I would also very much like to get input on this
Hope someone can help.