Leighton21
Technical User
Hi All,
I have this code
$computer = gc env:computername
Get-Content -Path 'C:\temp\error.log' -Tail 1 -Wait | where {$_.contains("error")} | ForEach-Object -Process {send-mailmessage -SMTPServer "SMTPSERVER" -to "someaddress@someaddress.com" -from "someaddress@someaddress.com" -subject ($computer+"-Error Detected") -Body $_}
which seems to work however sometimes the value from the Tail goes over multiple line e.g.
Error: The server has produced an error
Check Blah Blah
Is it possibple to return the whole error. When I take out the sendmessage and collect in the PS window then copy the tail line I get the hole lot I guess it has something to do the autosize
Regards
I have this code
$computer = gc env:computername
Get-Content -Path 'C:\temp\error.log' -Tail 1 -Wait | where {$_.contains("error")} | ForEach-Object -Process {send-mailmessage -SMTPServer "SMTPSERVER" -to "someaddress@someaddress.com" -from "someaddress@someaddress.com" -subject ($computer+"-Error Detected") -Body $_}
which seems to work however sometimes the value from the Tail goes over multiple line e.g.
Error: The server has produced an error
Check Blah Blah
Is it possibple to return the whole error. When I take out the sendmessage and collect in the PS window then copy the tail line I get the hole lot I guess it has something to do the autosize
Regards