Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Last active November 14, 2022 23:25
Show Gist options
  • Save PrateekKumarSingh/c44fbda1f0b6c34434f523e566c204ac to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/c44fbda1f0b6c34434f523e566c204ac to your computer and use it in GitHub Desktop.
Function Create-HTMLDOMFromFile
{
Param(
[String] $FileName,
[String] $TagName,
[Int] $OuputCount = 11
)
$HTML = New-Object -Com "HTMLFile";
$Content = Get-Content -Path $FileName -raw
#To convert raw content to HTML DOM (Document object Model) and 2 stands for DOM level 2
$HTML.IHTMLDocument2_write($Content)
#Some data wrangling to extract the exact information
$HTML.all.tags($TagName) | select innertext -ExpandProperty innertext -First $OuputCount
}
#Create-HTMLDOMFromFile -FileName 'C:\Temp\DecompiledHTML\Command_Line_Options.htm' -TagName 'P'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment