Write-Host "Installing required PSWriteHTML module..." -ForegroundColor Cyan
Install-Module -Name PSWriteHTML -Force -AcceptLicense -Scope CurrentUser -ErrorAction SilentlyContinue
Write-Host "Generating OOBE flow diagram..." -ForegroundColor Cyan
# Note: Changed $PSScriptRoot to $env:TEMP so it works when executed from memory
New-HTML -TitleText 'OOBE' -Online -FilePath "$env:TEMP\OOBE.html" {
New-HTMLPanel {
New-HTMLDiagram -Height '2000px' -Width '3000px' {
New-DiagramOptionsInteraction -Hover $true
New-DiagramOptionsPhysics -Enabled $true
New-DiagramOptionsLayout -RandomSeed 0
New-DiagramOptionsLinks -ArrowsToEnabled $true -Color BlueViolet -ArrowsToType arrow -ArrowsFromEnabled $false
New-DiagramOptionsNodes -BorderWidth 1 -FontColor Black -Size 16 -FontMulti true
$file = "C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\data\prod\navigation.json"
if (-not (Test-Path $file)) {
Write-Warning "Could not find the OOBE navigation.json file on this system."
return
}
$nav = Get-Content $file | ConvertFrom-Json -Depth 999 -AsHashtable
$nav.FRXINCLUSIVE.Keys | Where-Object { $nav.FRXINCLUSIVE.$_.count -gt 1} | ForEach-Object {
Write-Host "Mapping Node: $_"
New-DiagramNode -Label "$_" -IconSolid desktop -Title "$_"
if ($null -ne $nav.FRXINCLUSIVE.$_.successID) {
New-DiagramLink -From "$_" -To "$($nav.FRXINCLUSIVE.$_.successID)"
}
}
}
}
} -ShowHTML