I believe I’ve accomplished what you are looking for with HTML DOM parsing, which is the first attempt in Powershell and my head hurts a little from beating it on my desk. However, this looks like a dashboard for some internal status, so I would highly suggest trying to get access to a database\view\webservice or something to get raw data versus page crawling. This could work today and tomorrow it will not because you are the mercy of the developers and how the parsing is setup in the script at the moment.
I took the Output1 and 2 text files and just put a starting and ending table tags and ran the script against a local copy. From reading through your conversation thus far, it looks like you are trying to get critical and warning status by filtering on the color during your parse. I would leverage Powershell and pull all results and then filter on those results versus trying to figure out all of the DOM parsing to only pull certain results. This code:
$ie = New-Object -com “InternetExplorer.Application”
$ie.navigate(“C:\Users\Rob\Desktop\output2.html”)
$htmlResults = @()
foreach($table in $ie.Document.getElementsByTagName(“table”)) {
$tableHdr = @()
foreach($th in $table.getElementsByTagName("th")) {
$columnName = $th.getElementsByTagName("a").Item(0).innerHTML
$tableHdr += $columnName
}
foreach($tr in $table.getElementsByTagName("tr")) {
#filter to find the rows in the table where the data is
if($tr.style.backgroundColor -eq "rgb(239, 243, 251)" -or $tr.style.backgroundColor -eq "white") {
$tds = $tr.getElementsByTagName("td")
$rowProps = New-Object PSObject
for ($i=0; $i -lt $tds.Length; $i++) {
if ($tds.Item($i).innerHTML -like "<span*") {
$rowProps | Add-Member -MemberType NoteProperty -Name $tableHdr[$i].ToString() -Value ($tds.Item($i).getElementsByTagName("span").Item(0).innerHTML)
}
else {
$rowProps | Add-Member -MemberType NoteProperty -Name $tableHdr[$i].ToString() -Value ($tds.Item($i).innerHTML)
}
}
$htmlResults += $rowProps
}
}
}
$htmlResults
$ie.Quit()
produces the following results (removed the Email and OWA for formatting):
Council Services Description Status Information
—————- ———– —— ———–
Carefirst – Adults No major problems Green
Citrix No major problems Green
Civica APP No major problems Green
Civica IBS No major problems Green
website No major problems Green
EDRMS No major issues Green
Payroll System No major problems Green
Frontline No major problems Green
Internet No major problems Green
Intranet No major problems Green
Tribal – Childrens’ No major problems Green
Northgate Housing System No major issues Green
Wireless network No major issues. Green
SAP No major problems Green
VOIP Telephone System No major problems Green
VPN Homeworking Access No major problems Green
PECOS No major problems Green
PARIS No major problems. Green
Other No major problems Green
Mobile Telephony Service No major problems Green
Office Online No major problems Green
iTrent HR Payroll No major problems Green
Now that you have that, if there were Red or Yellow status, you could just do simple filters:
$htmlResults | Where {$_.Status -eq “Red”}