diff --git a/README.md b/README.md index 112e91f..bdcc91e 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,13 @@ The Full report contains everything from Mid plus additional information such as * SFC system-file verification * Important Windows directories -The Full report is intended for troubleshooting rather than quick inventory. +Full also includes complete signed PnP and system driver inventories, Driver +Store packages, explicit Get-Disk and storage PnP enumeration, filesystem filters +and UpperFilters/LowerFilters registrations, all services, boot configuration, +enabled Windows features, Code Integrity events, reliability records, and crash +dump file metadata. Dump contents are not read. + +Full mode is read-only and intended to collect evidence for troubleshooting. It does not automatically diagnose, repair, update, disable, uninstall or replace drivers or devices. ## Local Usage @@ -171,7 +177,7 @@ If no output directory is specified and the Documents folder is unavailable or n ### Event Log History -The Full report includes recent Windows event-log errors. +The Full report includes recent Windows event history and reliability records. The default range is 7 days. @@ -183,7 +189,10 @@ To inspect the last 30 days: ### Maximum Event Errors -By default, up to 100 errors from each event log are included. +By default, up to 100 events from each event log are included, newest first. +System and Application include Critical, Error and Warning events. Code Integrity +includes all levels. Repeated events are retained. Each event section records +`limit` and `truncated`; one extra event is requested to detect truncation. For example: @@ -193,43 +202,32 @@ For example: ## Output -The report is displayed live in the terminal while it is being collected. - -At the same time, the output is continuously written to a text file. - -The filename contains the computer name and timestamp: +Collection progress is displayed in the terminal. The completed report is saved +as UTF-8 JSON without a BOM: ```text -windows_system_report_COMPUTERNAME_YYYYMMDD_HHMMSS.txt +windows_system_report_COMPUTERNAME_YYYYMMDD_HHMMSS.json ``` -For example: - -```text -windows_system_report_DESKTOP01_20260904_124500.txt -``` - -The report file is flushed continuously, so information already collected remains available even while slower diagnostics are still running. +Schema version **2** introduces bounded event histories (including warnings), +new Full-mode inventories, and Compact collection-status metadata. The old +`recent_system_errors` and `recent_application_errors` sections are replaced by +`recent_system_events` and `recent_application_events`. ## Administrator Privileges -The script can run without Administrator privileges. +All three modes support non-administrator sessions. Admin-only checks (DISM, +SFC, filter enumeration, boot configuration and Windows optional features) are +marked `skipped`. Storage reliability counters also record an admin skip. +Other denied or unavailable checks are recorded and collection continues. +`host.administrator` records elevation; `warnings` describes limited access. +A writable output directory is still required. -When not elevated, it collects everything available to the current user and skips diagnostics that require administrative access. - -For the most complete results, launch PowerShell **as Administrator**. - -The report indicates whether the current session is elevated: - -```text -Administrator: True -``` - -or: - -```text -Administrator: False -``` +Detailed sections contain `status`, `count`, `data` and `error`. Native command +failures retain executable, arguments, exit code and output. Full mode also +includes `diagnostic_collection`, with booleans derived from section status; +these indicate collection completeness, not system health. Compact retains +per-check status, count and error without duplicating its summary data. ## Read-Only Diagnostics @@ -437,3 +435,19 @@ when PSScriptAnalyzer is first saved. Modules are cached in `.tools/psmodules` inside the writable workspace. The pipeline uses the installed PowerShell 7+ runtime rather than downloading a Linux binary. Jenkins needs Declarative Pipeline and Timestamper support; the AnsiColor plugin is not required. + +## Windows runtime validation + +Run each command in both a normal and an elevated Windows PowerShell 5.1 session: + +```powershell +.\WindowsMaintenanceReport.ps1 +.\WindowsMaintenanceReport.ps1 -Mid +.\WindowsMaintenanceReport.ps1 -Full +.\WindowsMaintenanceReport.ps1 -Full -EventLogDays 30 +``` + +For each returned path, validate JSON using `Get-Content -LiteralPath $path -Raw | +ConvertFrom-Json`. Check non-admin skips, unavailable sections, native exit codes, +event limits, and `diagnostic_collection`. Static CI checks cannot verify Windows +API availability or access permissions. diff --git a/WindowsMaintenanceReport.ps1 b/WindowsMaintenanceReport.ps1 index be90a2d..231fdbb 100644 --- a/WindowsMaintenanceReport.ps1 +++ b/WindowsMaintenanceReport.ps1 @@ -9,7 +9,14 @@ Modes: Default Compact maintenance snapshot -Mid Hardware/software/startup/driver inventory -Full Everything, including networking, event logs, processes, - firewall, devices, DISM and SFC verification. + driver stores, kernel/filter drivers, services, virtualization, + storage/PnP, Code Integrity, reliability and crash metadata. + Includes read-only DISM and SFC verification when elevated. + +All modes support non-administrator sessions. Restricted or unavailable checks +are recorded in the JSON and collection continues. Full mode collects evidence; +it does not automatically diagnose, repair, update, disable, uninstall or replace +drivers or devices. Schema version 2 adds collection status and bounded events. Examples: .\WindowsMaintenanceReport.ps1 @@ -88,8 +95,12 @@ function Get-InstalledPrograms { 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' ) - Get-ItemProperty $paths -ErrorAction SilentlyContinue | - Where-Object { $_.DisplayName } | + $(foreach ($path in $paths) { + $parent = Split-Path $path -Parent + if (Test-Path -LiteralPath $parent -ErrorAction Stop) { + Get-ItemProperty $path -ErrorAction Stop + } + }) | Where-Object { $_.DisplayName } | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation | Sort-Object DisplayName -Unique @@ -106,7 +117,7 @@ function Get-StartupRegistryEntries { foreach ($key in $startupKeys) { if (Test-Path $key) { - $item = Get-ItemProperty $key -ErrorAction SilentlyContinue + $item = Get-ItemProperty $key -ErrorAction Stop foreach ($property in $item.PSObject.Properties) { if ($property.Name -notlike 'PS*') { @@ -123,14 +134,16 @@ function Get-StartupRegistryEntries { function Get-ProblemDevices { if (Get-Command Get-PnpDevice -ErrorAction SilentlyContinue) { - Get-PnpDevice -PresentOnly -ErrorAction SilentlyContinue | - Where-Object { $_.Status -ne 'OK' } | - Select-Object Status, Class, FriendlyName, InstanceId + Get-PnpDevice -PresentOnly -ErrorAction Stop | + Where-Object { $_.Status -ne 'OK' -or ($null -ne $_.Problem -and [int]$_.Problem -ne 0) -or ($null -ne $_.ConfigManagerErrorCode -and $_.ConfigManagerErrorCode -ne 0) } | + Select-Object Status, Class, FriendlyName, InstanceId, Problem, ConfigManagerErrorCode } else { - Get-CimInstance Win32_PnPEntity -ErrorAction SilentlyContinue | + Get-CimInstance Win32_PnPEntity -ErrorAction Stop | Where-Object { $_.ConfigManagerErrorCode -ne 0 } | - Select-Object Name, PNPClass, ConfigManagerErrorCode, DeviceID + Select-Object Status, @{Name='Class';Expression={$_.PNPClass}}, + @{Name='FriendlyName';Expression={$_.Name}}, + @{Name='InstanceId';Expression={$_.DeviceID}}, Problem, ConfigManagerErrorCode } } @@ -150,18 +163,22 @@ function Invoke-ReportSection { } try { + $ErrorActionPreference = 'Stop' $data = @(& $Script) + $nativeFailures = @($data | Where-Object { + $_.PSObject.Properties['exit_code'] -and ($null -eq $_.exit_code -or $_.exit_code -ne 0) + }) return [pscustomobject][ordered]@{ - status = 'ok' + status = if ($nativeFailures.Count) { 'unavailable' } else { 'ok' } count = $data.Count data = $data - error = $null + error = if ($nativeFailures.Count) { 'Native command failed; see exit_code and output.' } else { $null } } } catch { return [pscustomobject][ordered]@{ - status = 'error' + status = 'unavailable' count = 0 data = @() error = $_.Exception.Message @@ -218,6 +235,9 @@ function Get-StorageReport { $storageHealth = @() $reliability = @() + if (-not $IsAdmin) { + $reliability = @(New-SkippedSection 'Administrator privileges required.') + } if (Get-Command Get-PhysicalDisk -ErrorAction SilentlyContinue) { try { @@ -312,6 +332,9 @@ function Invoke-NativeCommand { ) try { + # Windows PowerShell can emit native stderr as non-terminating errors. + $ErrorActionPreference = 'Continue' + $null = Get-Command $FilePath -CommandType Application -ErrorAction Stop $output = @(& $FilePath @Arguments 2>&1 | ForEach-Object { [string]$_ }) $exitCode = $LASTEXITCODE @@ -368,7 +391,7 @@ $reportName = 'windows_system_report_' + $computerName + '_' + $timestamp + '.js $reportPath = Join-Path $OutputDirectory $reportName $report = [ordered]@{ - schema_version = 1 + schema_version = 2 report_type = 'windows_system_maintenance' mode = $mode generated_at = $startedAt.ToString('o') @@ -398,27 +421,40 @@ if (-not $isAdmin) { if ($mode -eq 'Compact') { Write-Host 'Collecting compact Windows maintenance report...' - $os = Get-CimInstance Win32_OperatingSystem - $system = Get-CimInstance Win32_ComputerSystem - $bios = Get-CimInstance Win32_BIOS - $cpu = Get-CimInstance Win32_Processor | Select-Object -First 1 - $gpus = @(Get-CimInstance Win32_VideoController -ErrorAction SilentlyContinue) - $logicalDisks = @(Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3") - $programs = @(Get-InstalledPrograms) - $appx = @(Get-AppxPackage -ErrorAction SilentlyContinue) - $startupRegistry = @(Get-StartupRegistryEntries) - $startupCommands = @(Get-CimInstance Win32_StartupCommand -ErrorAction SilentlyContinue) - $autoServices = @( - Get-CimInstance Win32_Service -ErrorAction SilentlyContinue | - Where-Object { $_.StartMode -eq 'Auto' } - ) - $stoppedAuto = @($autoServices | Where-Object { $_.State -ne 'Running' }) - $problemDevices = @(Get-ProblemDevices) - $latestHotfix = Get-HotFix -ErrorAction SilentlyContinue | - Sort-Object InstalledOn -Descending | - Select-Object -First 1 + function Get-CompactData { + param([string]$Name, [scriptblock]$Script) + $section = Invoke-ReportSection $Name $Script -Quiet + # Keep Compact small and avoid serializing raw CIM object graphs. + $report.sections[$Name] = [pscustomobject][ordered]@{ + status = $section.status + count = $section.count + error = $section.error + } + if ($section.status -ne 'ok') { + $report.warnings += ($Name + ': ' + $section.error) + } + $section.data + } - $uptime = (Get-Date) - $os.LastBootUpTime + $os = Get-CompactData 'operating_system' { Get-CimInstance Win32_OperatingSystem } + $system = Get-CompactData 'computer_system' { Get-CimInstance Win32_ComputerSystem } + $bios = Get-CompactData 'bios' { Get-CimInstance Win32_BIOS } + $cpu = Get-CompactData 'cpu' { Get-CimInstance Win32_Processor | Select-Object -First 1 } + $gpus = @(Get-CompactData 'gpus' { Get-CimInstance Win32_VideoController }) + $logicalDisks = @(Get-CompactData 'logical_disks' { Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" }) + $programs = @(Get-CompactData 'installed_programs' { Get-InstalledPrograms }) + $appx = @(Get-CompactData 'appx_packages' { Get-AppxPackage -ErrorAction Stop }) + $startupRegistry = @(Get-CompactData 'startup_registry' { Get-StartupRegistryEntries }) + $startupCommands = @(Get-CompactData 'startup_programs' { Get-CimInstance Win32_StartupCommand }) + $autoServices = @(Get-CompactData 'automatic_services' { + Get-CimInstance Win32_Service | Where-Object { $_.StartMode -eq 'Auto' } + }) + $stoppedAuto = @($autoServices | Where-Object { $_.State -ne 'Running' }) + $problemDevices = @(Get-CompactData 'problem_devices' { Get-ProblemDevices }) + $latestHotfix = Get-CompactData 'latest_hotfix' { + Get-HotFix -ErrorAction Stop | Sort-Object InstalledOn -Descending | Select-Object -First 1 + } + $uptime = if ($os.LastBootUpTime) { (Get-Date) - $os.LastBootUpTime } else { $null } $diskSummary = @( $logicalDisks | ForEach-Object { @@ -483,8 +519,8 @@ if ($mode -eq 'Compact') { } memory = [ordered]@{ - total_gb = [math]::Round($system.TotalPhysicalMemory / 1GB, 2) - free_gb = [math]::Round($os.FreePhysicalMemory / 1MB, 2) + total_gb = $(if ($null -ne $system.TotalPhysicalMemory) { [math]::Round($system.TotalPhysicalMemory / 1GB, 2) } else { $null }) + free_gb = $(if ($null -ne $os.FreePhysicalMemory) { [math]::Round($os.FreePhysicalMemory / 1MB, 2) } else { $null }) } gpus = @( @@ -597,7 +633,7 @@ else { if (Get-Command Get-AppxPackage -ErrorAction SilentlyContinue) { $report.sections.appx_packages = Invoke-ReportSection 'Microsoft Store / AppX packages' { - Get-AppxPackage -ErrorAction SilentlyContinue | + Get-AppxPackage -ErrorAction Stop | Select-Object Name, Version, Publisher, Architecture | Sort-Object Name } @@ -621,13 +657,13 @@ else { $report.sections.signed_drivers = Invoke-ReportSection 'Signed drivers' { Get-CimInstance Win32_PnPSignedDriver | - Where-Object { $_.DeviceName } | - Select-Object DeviceName, Manufacturer, DriverVersion, DriverDate | + Select-Object DeviceName, DeviceClass, Manufacturer, DriverProviderName, + DriverVersion, DriverDate, InfName, IsSigned, Signer, DeviceID | Sort-Object DeviceName } $report.sections.hotfixes = Invoke-ReportSection 'Windows updates / hotfixes' { - Get-HotFix -ErrorAction SilentlyContinue | + Get-HotFix -ErrorAction Stop | Sort-Object InstalledOn -Descending | Select-Object HotFixID, Description, InstalledBy, InstalledOn } @@ -639,7 +675,7 @@ else { if (Get-Command Get-ScheduledTask -ErrorAction SilentlyContinue) { $report.sections.non_microsoft_scheduled_tasks = Invoke-ReportSection 'Non-Microsoft scheduled tasks' { - Get-ScheduledTask -ErrorAction SilentlyContinue | + Get-ScheduledTask -ErrorAction Stop | Where-Object { $_.TaskPath -notlike '\Microsoft\*' } | Select-Object TaskName, TaskPath, State | Sort-Object TaskPath, TaskName @@ -654,6 +690,78 @@ else { # FULL-ONLY SECTIONS # ---------------------------------------------------------------------- if ($Full) { + $report.sections.system_drivers = Invoke-ReportSection 'System drivers' { + Get-CimInstance Win32_SystemDriver | + Select-Object Name, DisplayName, State, StartMode, PathName, ServiceType + } + $report.sections.services = Invoke-ReportSection 'Services' { + Get-CimInstance Win32_Service | + Select-Object Name, DisplayName, State, StartMode, StartName, PathName + } + $report.sections.storage_disks = Invoke-ReportSection 'Storage disks' { + Get-Disk -ErrorAction Stop | Select-Object Number, FriendlyName, SerialNumber, + BusType, OperationalStatus, HealthStatus, PartitionStyle, Size, + IsBoot, IsSystem, FirmwareVersion, Location + } + $report.sections.storage_pnp_devices = Invoke-ReportSection 'Storage PnP devices' { + $classes = @('SCSIAdapter', 'HDC', 'DiskDrive', 'Storage', 'System') + if (Get-Command Get-PnpDevice -ErrorAction SilentlyContinue) { + Get-PnpDevice -PresentOnly -ErrorAction Stop | + Where-Object { $_.Class -in $classes } | + Select-Object Status, Class, FriendlyName, InstanceId, Problem, ConfigManagerErrorCode + } + else { + Get-CimInstance Win32_PnPEntity | Where-Object { $_.Present -and $_.PNPClass -in $classes } | + Select-Object Status, @{Name='Class';Expression={$_.PNPClass}}, + @{Name='FriendlyName';Expression={$_.Name}}, + @{Name='InstanceId';Expression={$_.DeviceID}}, Problem, ConfigManagerErrorCode + } + } + $nativeInventories = @( + @{ Key='driver_store'; Exe='pnputil.exe'; Args=@('/enum-drivers'); Admin=$false }, + @{ Key='filter_drivers'; Exe='fltmc.exe'; Args=@('filters'); Admin=$true }, + @{ Key='filter_instances'; Exe='fltmc.exe'; Args=@('instances'); Admin=$true }, + @{ Key='upper_filters'; Exe='reg.exe'; Args=@('query', 'HKLM\SYSTEM\CurrentControlSet\Control\Class', '/s', '/v', 'UpperFilters'); Admin=$false }, + @{ Key='lower_filters'; Exe='reg.exe'; Args=@('query', 'HKLM\SYSTEM\CurrentControlSet\Control\Class', '/s', '/v', 'LowerFilters'); Admin=$false }, + @{ Key='boot_configuration'; Exe='bcdedit.exe'; Args=@('/enum', 'all'); Admin=$true } + ) + foreach ($inventory in $nativeInventories) { + if ($inventory.Admin -and -not $isAdmin) { + $report.sections[$inventory.Key] = New-SkippedSection 'Administrator privileges required.' + } + else { + $report.sections[$inventory.Key] = Invoke-ReportSection $inventory.Key { + Invoke-NativeCommand -FilePath $inventory.Exe -Arguments $inventory.Args + } + } + } + if ($isAdmin) { + $report.sections.enabled_windows_features = Invoke-ReportSection 'Enabled Windows features' { + Get-WindowsOptionalFeature -Online -ErrorAction Stop | + Where-Object { $_.State -eq 'Enabled' } | Select-Object FeatureName, State + } + } + else { + $report.sections.enabled_windows_features = New-SkippedSection 'Administrator privileges required.' + } + $report.sections.reliability_records = Invoke-ReportSection 'Reliability records' { + $since = (Get-Date).ToUniversalTime().AddDays(-$EventLogDays).ToString('yyyyMMddHHmmss.000000') + Get-CimInstance Win32_ReliabilityRecords -Filter ("TimeGenerated >= '" + $since + "+000'") | + Select-Object TimeGenerated, SourceName, EventIdentifier, ProductName, Message + } + $report.sections.minidumps = Invoke-ReportSection 'Crash dump metadata' { + $dumpDirectory = Join-Path $env:SystemRoot 'Minidump' + if (Test-Path -LiteralPath $dumpDirectory -ErrorAction Stop) { + Get-ChildItem -LiteralPath $dumpDirectory -File -ErrorAction Stop | + Select-Object Name, Length, CreationTime, LastWriteTime + } + $memoryDump = Join-Path $env:SystemRoot 'MEMORY.DMP' + if (Test-Path -LiteralPath $memoryDump -ErrorAction Stop) { + Get-Item -LiteralPath $memoryDump -ErrorAction Stop | + Select-Object Name, Length, CreationTime, LastWriteTime + } + } + $report.sections.uptime = Invoke-ReportSection 'Uptime' { $os = Get-CimInstance Win32_OperatingSystem $uptime = (Get-Date) - $os.LastBootUpTime @@ -679,12 +787,12 @@ else { ) foreach ($folder in $folders) { - $exists = Test-Path $folder + $exists = Test-Path $folder -ErrorAction Stop $items = @() if ($exists) { $items = @( - Get-ChildItem $folder -Force -ErrorAction SilentlyContinue | + Get-ChildItem $folder -Force -ErrorAction Stop | Select-Object Name, FullName, LastWriteTime ) } @@ -712,7 +820,7 @@ else { if (Get-Command Get-NetFirewallProfile -ErrorAction SilentlyContinue) { $report.sections.firewall_profiles = Invoke-ReportSection 'Firewall profiles' { - Get-NetFirewallProfile -ErrorAction SilentlyContinue | + Get-NetFirewallProfile -ErrorAction Stop | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction } @@ -724,7 +832,7 @@ else { if (Get-Command Get-NetAdapter -ErrorAction SilentlyContinue) { $report.sections.network_adapters = Invoke-ReportSection 'Network adapters' { - Get-NetAdapter -ErrorAction SilentlyContinue | + Get-NetAdapter -ErrorAction Stop | Select-Object Name, InterfaceDescription, Status, LinkSpeed, MacAddress } @@ -736,7 +844,7 @@ else { $report.sections.ip_configuration = Invoke-ReportSection 'IP configuration' { if (Get-Command Get-NetIPConfiguration -ErrorAction SilentlyContinue) { - Get-NetIPConfiguration -ErrorAction SilentlyContinue | + Get-NetIPConfiguration -ErrorAction Stop | ForEach-Object { [pscustomobject][ordered]@{ interface_alias = $_.InterfaceAlias @@ -756,7 +864,7 @@ else { if (Get-Command Get-DnsClientServerAddress -ErrorAction SilentlyContinue) { $report.sections.dns_servers = Invoke-ReportSection 'DNS servers' { - Get-DnsClientServerAddress -ErrorAction SilentlyContinue | + Get-DnsClientServerAddress -ErrorAction Stop | Where-Object { $_.ServerAddresses.Count -gt 0 } | Select-Object InterfaceAlias, AddressFamily, @{Name='servers';Expression={@($_.ServerAddresses)}} @@ -770,7 +878,7 @@ else { if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) { $report.sections.active_tcp_listeners = Invoke-ReportSection 'Active TCP listeners' { - Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | + Get-NetTCPConnection -State Listen -ErrorAction Stop | Select-Object LocalAddress, LocalPort, OwningProcess | Sort-Object LocalPort } @@ -787,7 +895,7 @@ else { } $report.sections.battery = Invoke-ReportSection 'Battery' { - Get-CimInstance Win32_Battery -ErrorAction SilentlyContinue | + Get-CimInstance Win32_Battery -ErrorAction Stop | Select-Object Name, Status, EstimatedChargeRemaining, EstimatedRunTime, BatteryStatus } @@ -803,27 +911,33 @@ else { $start = (Get-Date).AddDays(-$EventLogDays) - $report.sections.recent_system_errors = - Invoke-ReportSection ('Recent system errors - last ' + $EventLogDays + ' days') { - Get-WinEvent -FilterHashtable @{ - LogName = 'System' - Level = 2 - StartTime = $start - } -ErrorAction SilentlyContinue | - Select-Object -First $MaxEventErrors TimeCreated, Id, - ProviderName, Message + foreach ($log in @( + @{ Key='recent_system_events'; Name='System'; Levels=@(1,2,3) }, + @{ Key='recent_application_events'; Name='Application'; Levels=@(1,2,3) }, + @{ Key='code_integrity'; Name='Microsoft-Windows-CodeIntegrity/Operational'; Levels=@(1,2,3,4,5) } + )) { + $section = Invoke-ReportSection $log.Name { + $logInfo = Get-WinEvent -ListLog $log.Name -ErrorAction Stop + if (-not $logInfo.IsEnabled) { throw 'Event log is disabled.' } + try { + Get-WinEvent -FilterHashtable @{ + LogName=$log.Name; Level=$log.Levels; StartTime=$start + } -MaxEvents ($MaxEventErrors + 1) -ErrorAction Stop | + Select-Object TimeCreated, ProviderName, Id, Level, LevelDisplayName, Message + } + catch { + if ($_.FullyQualifiedErrorId -notlike 'NoMatchingEventsFound*') { throw } + } } - - $report.sections.recent_application_errors = - Invoke-ReportSection ('Recent application errors - last ' + $EventLogDays + ' days') { - Get-WinEvent -FilterHashtable @{ - LogName = 'Application' - Level = 2 - StartTime = $start - } -ErrorAction SilentlyContinue | - Select-Object -First $MaxEventErrors TimeCreated, Id, - ProviderName, Message + $truncated = $section.count -gt $MaxEventErrors + if ($truncated) { + $section.data = @($section.data | Select-Object -First $MaxEventErrors) + $section.count = $section.data.Count } + $section | Add-Member -NotePropertyName truncated -NotePropertyValue $truncated + $section | Add-Member -NotePropertyName limit -NotePropertyValue $MaxEventErrors + $report.sections[$log.Key] = $section + } if ($isAdmin) { $report.sections.component_store = @@ -892,6 +1006,13 @@ else { } } +if ($Full) { + $report.diagnostic_collection = [ordered]@{} + foreach ($key in $report.sections.Keys) { + $report.diagnostic_collection[$key] = ($report.sections[$key].status -eq 'ok') + } +} + $report.completed_at = (Get-Date).ToString('o') $json = $report | ConvertTo-Json -Depth $JsonDepth