Curated Examples
Export Active Directory data to HTML
Use PSWinDocumentation.AD data to build a simple HTML dashboard.
This pattern is useful when collected Active Directory data should become a browsable HTML artifact.
It is adapted from Examples/Example-03-ExportActiveDirectoryToHTML.ps1.
Example
Import-Module PSWinDocumentation.AD
$forest = Get-WinADForestInformation -Verbose -PasswordQuality -DontRemoveEmpty -Parallel -Splitter "`r`n"
$reportPath = Join-Path $PSScriptRoot 'Output\DashboardActiveDirectory.html'
New-Item -ItemType Directory -Path (Split-Path $reportPath) -Force | Out-Null
Dashboard -Name 'Active Directory Review' -FilePath $reportPath -Show {
Tab -Name 'Forest' {
foreach ($forestKey in $forest.Keys | Where-Object { $_ -ne 'FoundDomains' }) {
Section -Name $forestKey -Collapsable {
Table -DataTable $forest.$forestKey -HideFooter
}
}
}
}
What this demonstrates
- turning collected AD data into HTML
- keeping output under a script-local folder
- starting with forest-level data before adding domain tabs