We receive a email every day that shows us what has pass or failed its backup. What I have done is extract the HTMLbody of the email and placed in into its own html file body.html.
The body.html is like the following
11 headings
Server, Client, Status, Group, Job, Size Scanned (TB), Started, Finished, Duration (hour), Retention (week), Expires
Under each heading it has data.
I want to be able to search the html body.html for the word "failed" (which will be only located under the Status column and return the whole line.
I have tried to grab it into a variable and then do a search on it. But it returns all the code.
Any ideas ?
$Outlook = New-Object -ComObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item(1).Folders
$OutlookInbox = $Outlook.session.GetDefaultFolder(6)
$latestmail=$OutlookInbox.items | select -last 1
$emailhtmlbody=$latestmail.HTMLBody
$emailhtmlbody | out-file d:\delme\test\body.html