Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions Scripts/Export-GHEntraFido.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,21 @@ Function Export-GHEntraFido {
[string]$Url
)

if (-not ('HtmlAgilityPack.HtmlDocument' -as [type])) {
$dll = Get-ChildItem -Path $HOME -Recurse -Filter HtmlAgilityPack.dll -ErrorAction SilentlyContinue |
Select-Object -First 1

if (-not $dll) {
throw "HtmlAgilityPack.dll not found. Ensure the dependency is installed before running Export-GHEntraFido."
if (-not (Get-Module -Name PSParseHTML)) {
Import-Module PSParseHTML -ErrorAction Stop
}

Add-Type -Path $dll.FullName
}
if (-not ('HtmlAgilityPack.HtmlDocument' -as [type])) {
$module = Get-Module PSParseHTML
$dll = Get-ChildItem -Path $module.ModuleBase -Recurse -Filter HtmlAgilityPack.dll -ErrorAction SilentlyContinue |
Select-Object -First 1

$response = Invoke-WebRequest -Uri $Url -UseBasicParsing
$htmlContent = $response.Content
if (-not $dll) {
throw "HtmlAgilityPack.dll not found under PSParseHTML module path. Ensure PSParseHTML is installed before running Export-GHEntraFido."
}

$htmlDocument = New-Object HtmlAgilityPack.HtmlDocument
$htmlDocument.LoadHtml($htmlContent)
Add-Type -Path $dll.FullName
}

# Fetch the webpage content
$response = Invoke-WebRequest -Uri $Url -UseBasicParsing
Expand Down
Loading