From 2ac62535a5741c3b6e72da10f47ec6e834114fc0 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Tue, 10 Mar 2026 16:47:37 -0400 Subject: [PATCH 01/13] Bump module versions to 0.1.3 and update changelog for migration to AsBuiltReport.Diagram --- AsBuiltReport.System.Resources.psd1 | 8 ++++---- CHANGELOG.md | 9 +++++++++ Todo.md | 10 +++++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/AsBuiltReport.System.Resources.psd1 b/AsBuiltReport.System.Resources.psd1 index ef0a682..db373a9 100644 --- a/AsBuiltReport.System.Resources.psd1 +++ b/AsBuiltReport.System.Resources.psd1 @@ -12,7 +12,7 @@ RootModule = 'AsBuiltReport.System.Resources.psm1' # Version number of this module. - ModuleVersion = '0.1.2' + ModuleVersion = '0.1.3' # Supported PSEditions # CompatiblePSEditions = @() @@ -59,11 +59,11 @@ }, @{ ModuleName = 'AsBuiltReport.Chart'; - ModuleVersion = '0.2.0' + ModuleVersion = '0.3.0' }, @{ - ModuleName = 'Diagrammer.Core'; - ModuleVersion = '0.2.38' + ModuleName = 'AsBuiltReport.Diagram'; + ModuleVersion = '1.0.0' } ) diff --git a/CHANGELOG.md b/CHANGELOG.md index f485f57..785db01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2026-03-?? + +### Changed + +- Migrate Diagrammer.Core to AsBuiltReport.Diagram for better integration and maintenance + - Update module dependencies to reflect the change + - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core +- Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements + ## [0.1.2] - 2026-02-22 ### Added diff --git a/Todo.md b/Todo.md index 7e5917b..9ba0878 100644 --- a/Todo.md +++ b/Todo.md @@ -1,8 +1,8 @@ - [x] Update README.md with usage examples - [ ] Add HealthCheck support - [ ] Test multi-language in HealthChecks -- [ ] Add support for charts - - [ ] CPU usage charts - - [ ] Memory usage charts -- [ ] Add support for diagrams - - [ ] Process diagrams \ No newline at end of file +- [X] Add support for charts + - [X] CPU usage charts + - [X] Memory usage charts +- [x] Add support for diagrams + - [x] Process diagrams \ No newline at end of file From 86460ede513767d147ffe2ee4c063cf8c64bcd7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:08:59 +0000 Subject: [PATCH 02/13] Initial plan From bb06ea83980105951ba410a717c7dd168113a4b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:19:00 +0000 Subject: [PATCH 03/13] Document all source code for teaching purposes and apply code quality fixes Co-authored-by: rebelinux <1002783+rebelinux@users.noreply.github.com> --- AsBuiltReport.System.Resources.psm1 | 20 +++++- Src/Private/Export-AbrDiagram.ps1 | 61 ++++++++++++++-- Src/Private/Get-AbrDate.ps1 | 31 ++++++-- Src/Private/Get-AbrPSHost.ps1 | 41 +++++++++-- Src/Private/Get-AbrProcessDiagram.ps1 | 70 ++++++++++++++----- Src/Private/Get-AbrProcessInfo.ps1 | 58 +++++++++++++-- Src/Private/Get-AbrTimeZone.ps1 | 41 +++++++++-- Src/Private/Get-AbrUptime.ps1 | 49 +++++++++++-- Src/Private/Get-SystemUptime.ps1 | 30 +++++--- .../Invoke-AsBuiltReport.System.Resources.ps1 | 55 ++++++++++++++- 10 files changed, 399 insertions(+), 57 deletions(-) diff --git a/AsBuiltReport.System.Resources.psm1 b/AsBuiltReport.System.Resources.psm1 index e22b0dc..fd89e52 100644 --- a/AsBuiltReport.System.Resources.psm1 +++ b/AsBuiltReport.System.Resources.psm1 @@ -1,4 +1,19 @@ -# Get public and private function definition files and dot source them +# Module loader for AsBuiltReport.System.Resources +# +# This script is executed automatically by PowerShell when the module is imported. It uses a +# common AsBuiltReport pattern of separating functions into two directories: +# +# Src/Public/ - Functions exported to the caller (visible after Import-Module). +# Typically a single Invoke-AsBuiltReport. entry point. +# Src/Private/ - Internal helper functions used only within the module. They are dot-sourced +# into the module scope but are also exported so that AsBuiltReport.Core can +# call them from within the report document script block, which runs in the +# caller's scope. +# +# Any file that fails to dot-source (e.g. due to a syntax error) will emit an error message +# via Write-Error but will not prevent the remaining files from being loaded. + +# Collect all public and private function files. $Public = @(Get-ChildItem -Path $PSScriptRoot\Src\Public\*.ps1 -ErrorAction SilentlyContinue) $Private = @(Get-ChildItem -Path $PSScriptRoot\Src\Private\*.ps1 -ErrorAction SilentlyContinue) @@ -10,5 +25,8 @@ foreach ($Module in @($Public + $Private)) { } } +# Export public functions by name so they are available to module consumers. Export-ModuleMember -Function $Public.BaseName +# Export private functions so that AsBuiltReport.Core can invoke them from within the +# PScribo document script block, which executes in the caller's session scope. Export-ModuleMember -Function $Private.BaseName \ No newline at end of file diff --git a/Src/Private/Export-AbrDiagram.ps1 b/Src/Private/Export-AbrDiagram.ps1 index c7f6f27..312b8f0 100644 --- a/Src/Private/Export-AbrDiagram.ps1 +++ b/Src/Private/Export-AbrDiagram.ps1 @@ -1,23 +1,65 @@ function Export-AbrDiagram { <# .SYNOPSIS - Used by As Built Report to export diagrams + Used by As Built Report to export diagrams. .DESCRIPTION - Exports diagrams using the Diagrammer module based on user options set in the report options. + Renders and embeds a Graphviz diagram into the active PScribo report section using the + AsBuiltReport.Diagram module's New-Diagrammer cmdlet. Optionally, the diagram can also + be saved to disk in one or more formats. + + Behaviour is driven by the Options block of the report configuration JSON: + + EnableDiagrams - Master switch. When false the function exits immediately. + DiagramTheme - 'Black', 'Neon', or 'White' (default). Controls background + and font colours passed to New-Diagrammer. + DiagramWaterMark - Text watermark overlaid on the diagram image. + ExportDiagrams - When true, saves the diagram to OutputFolderPath on disk. + ExportDiagramsFormat - Array of formats to save (e.g. @('png', 'pdf', 'svg')). + Defaults to 'png' if not set. + EnableDiagramDebug - When true, passes DraftMode to New-Diagrammer so that + Graphviz debug styling (red borders, visible edges) is + rendered, which is useful for troubleshooting layout. + EnableDiagramSignature - When true, adds an author/company signature block. + SignatureAuthorName - Author name shown in the signature block. + SignatureCompanyName - Company name shown in the signature block. + EnableDiagramMainLogo - Controls whether the main logo is shown in the diagram. + + The diagram is always rendered as base64 and embedded in the report via the PScribo + Image cmdlet. If ExportDiagrams is also enabled the diagram is additionally written to + disk in the requested format(s) before the base64 pass. + .PARAMETER DiagramObject + The Graphviz graph object produced by the diagram builder function (e.g. + Get-AbrProcessDiagram). This is passed directly to New-Diagrammer as its -InputObject. + .PARAMETER MainDiagramLabel + Human-readable label used as the diagram title and as the PScribo Section heading. + Defaults to 'Change Me' if not specified. + .PARAMETER FileName + Base file name (without extension) used when saving the diagram to disk. + Required when ExportDiagrams is enabled. + .INPUTS + None. This function does not accept pipeline input. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section and Image + cmdlets. If ExportDiagrams is enabled, files are also written to OutputFolderPath. + .EXAMPLE + # Typically called from within a report section function such as Get-AbrProcessInfo: + $diagram = Get-AbrProcessDiagram + Export-AbrDiagram -DiagramObject $diagram -MainDiagramLabel 'Process Hierarchy Diagram' -FileName 'AsBuiltReport.System.Resources.Cluster' .NOTES Version: 0.1.2 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '', Scope = 'Function')] [CmdletBinding()] param ( + # The Graphviz graph object to render. No type constraint is applied because the + # PSGraph DSL returns a custom object type from the AsBuiltReport.Diagram module. $DiagramObject, [string] $MainDiagramLabel = 'Change Me', [Parameter(Mandatory = $true)] @@ -32,9 +74,12 @@ function Export-AbrDiagram { if ($Options.EnableDiagrams) { Write-PScriboMessage -Message "Collecting $MainDiagramLabel diagram" + # Resolve the icons directory relative to the module root so that icon images can + # be embedded into diagram nodes by New-Diagrammer. $RootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent [System.IO.FileInfo]$IconPath = Join-Path -Path $RootPath -ChildPath 'icons' + # Build the core parameter set shared by all New-Diagrammer invocations. $DiagramParams = @{ 'FileName' = $FileName 'OutputFolderPath' = $OutputFolderPath @@ -52,6 +97,7 @@ function Export-AbrDiagram { 'DisableMainDiagramLogo' = $Options.EnableDiagramMainLogo } + # Apply theme-specific colour overrides on top of the defaults. if ($Options.DiagramTheme -eq 'Black') { $DiagramParams.add('MainGraphBGColor', 'Black') $DiagramParams.add('Edgecolor', 'White') @@ -68,6 +114,7 @@ function Export-AbrDiagram { $DiagramParams.add('WaterMarkColor', '#333333') } + # When ExportDiagrams is enabled, write the diagram to disk in the requested formats. if ($Options.ExportDiagrams) { if (-not $Options.ExportDiagramsFormat) { $DiagramFormat = 'png' @@ -80,9 +127,9 @@ function Export-AbrDiagram { } if ($Options.EnableDiagramDebug) { - + # DraftMode enables Graphviz debug output (e.g. red borders on nodes/edges) + # to help identify layout problems during development. $DiagramParams.Add('DraftMode', $True) - } if ($Options.EnableDiagramSignature) { @@ -108,6 +155,8 @@ function Export-AbrDiagram { Write-PScriboMessage -IsWarning -Message "Unable to export the $MainDiagramLabel Diagram: $($_.Exception.Message)" } } + # Always render the diagram as base64 for embedding in the report, regardless of + # whether ExportDiagrams is enabled. Reuse $DiagramParams but swap the Format. try { $DiagramParams.Remove('Format') $DiagramParams.Add('Format', 'base64') diff --git a/Src/Private/Get-AbrDate.ps1 b/Src/Private/Get-AbrDate.ps1 index c5c96e5..a011cb7 100644 --- a/Src/Private/Get-AbrDate.ps1 +++ b/Src/Private/Get-AbrDate.ps1 @@ -1,24 +1,43 @@ function Get-AbrDate { <# .SYNOPSIS - Used by As Built Report to retrieve System Date information + Used by As Built Report to retrieve System Date information. .DESCRIPTION + Collects the current system date and time, then formats and renders it into the report + using PScribo cmdlets (Section, Table, Paragraph). The level of detail in the output + is controlled by the InfoLevel.Date setting in the report configuration JSON: + 0 - Disabled. The section is skipped entirely. + 1 - Summary. A single compact table showing Date and Hour for all targets. + 2 - Detailed. A per-target subsection with a list-style table. + + Localization is handled through the $reportTranslate variable, which is populated by + AsBuiltReport.Core from the appropriate Language/*.psd1 file. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($InfoLevel, $reportTranslate, $Report, $System) that are set by the + AsBuiltReport framework before this function is called. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section, Table, + Paragraph, and BlankLine cmdlets. + .EXAMPLE + # This function is called automatically by Invoke-AsBuiltReport.System.Resources. + # It is not designed to be called directly by end users. + Get-AbrDate .NOTES Version: 0.1.1 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( ) begin { + # Narrow the translation lookup to the GetAbrDate section of the language data. $reportTranslate = $reportTranslate.GetAbrDate Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'Date', $($InfoLevel.Date)) } @@ -30,6 +49,8 @@ function Get-AbrDate { if ($SystemDate) { Write-PScriboMessage $reportTranslate.Collecting Section -Style Heading2 $($reportTranslate.Heading) { + # Build an array of ordered hashtables so column order is preserved when + # converting to PSCustomObjects for the PScribo Table cmdlet. $SystemDateInfo = @() foreach ($Date in $SystemDate) { $InObj = [Ordered]@{ @@ -40,6 +61,7 @@ function Get-AbrDate { } if ($InfoLevel.Date -ge 2) { + # InfoLevel 2: render each target as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail foreach ($DateInfo in $SystemDateInfo) { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($System)" { @@ -55,6 +77,7 @@ function Get-AbrDate { } } } else { + # InfoLevel 1: render a single compact table across all targets. Paragraph $reportTranslate.ParagraphSummary BlankLine $TableParams = @{ diff --git a/Src/Private/Get-AbrPSHost.ps1 b/Src/Private/Get-AbrPSHost.ps1 index 9c1c65e..e471abe 100644 --- a/Src/Private/Get-AbrPSHost.ps1 +++ b/Src/Private/Get-AbrPSHost.ps1 @@ -2,24 +2,51 @@ function Get-AbrPSHost { <# .SYNOPSIS - Used by As Built Report to retrieve system PowerShell host information + Used by As Built Report to retrieve system PowerShell host information. .DESCRIPTION + Queries the current PowerShell host environment using Get-Host and renders the results + into the report using PScribo cmdlets. The following fields are captured: + - Name : The name of the PowerShell host application (e.g. 'ConsoleHost'). + - Version : The version string of the PowerShell host (e.g. '7.4.0'). + - CurrentCulture : The language/regional culture for formatting (e.g. 'en-US'). + - CurrentUICulture : The culture used for localized UI messages (e.g. 'en-US'). + - DebuggerEnabled : Whether the PowerShell debugger is currently enabled. + + The level of detail in the output is controlled by the InfoLevel.PSHost setting in + the report configuration JSON: + + 0 - Disabled. The section is skipped entirely. + 1 - Summary. A single compact table showing key fields for all targets. + 2 - Detailed. A per-target subsection with a full list-style table. + + Localization is handled through the $reportTranslate variable, which is populated by + AsBuiltReport.Core from the appropriate Language/*.psd1 file. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($InfoLevel, $reportTranslate, $Report, $System) that are set by the + AsBuiltReport framework before this function is called. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section, Table, + Paragraph, and BlankLine cmdlets. + .EXAMPLE + # This function is called automatically by Invoke-AsBuiltReport.System.Resources. + # It is not designed to be called directly by end users. + Get-AbrPSHost .NOTES Version: 0.1.1 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( ) begin { + # Narrow the translation lookup to the GetAbrPSHost section of the language data. $reportTranslate = $reportTranslate.GetAbrPSHost Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'PSHost', $($InfoLevel.PSHost)) } @@ -31,6 +58,8 @@ function Get-AbrPSHost { if ($SystemPSHost) { Write-PScriboMessage $reportTranslate.Collecting Section -Style Heading2 $($reportTranslate.Heading) { + # Build an array of ordered hashtables so column order is preserved when + # converting to PSCustomObjects for the PScribo Table cmdlet. $SystemPSHostInfo = @() foreach ($PSHost in $SystemPSHost) { $InObj = [Ordered]@{ @@ -38,6 +67,7 @@ function Get-AbrPSHost { $($reportTranslate.Version) = $PSHost.Version.ToString() $($reportTranslate.CurrentCulture) = $PSHost.CurrentCulture $($reportTranslate.CurrentUICulture) = $PSHost.CurrentUICulture + # Convert the boolean Debugger.IsEnabled to a localized Yes/No string. $($reportTranslate.DebuggerEnabled) = switch ($PSHost.Debugger.IsEnabled) { $true { $($reportTranslate.Yes) } $false { $($reportTranslate.No) } @@ -48,6 +78,7 @@ function Get-AbrPSHost { } if ($InfoLevel.PSHost -ge 2) { + # InfoLevel 2: render each target as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail foreach ($PSHostInfo in $SystemPSHostInfo) { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($System)" { @@ -63,6 +94,8 @@ function Get-AbrPSHost { } } } else { + # InfoLevel 1: render a single compact table across all targets, showing + # a subset of the most useful fields. Paragraph $reportTranslate.ParagraphSummary BlankLine $TableParams = @{ diff --git a/Src/Private/Get-AbrProcessDiagram.ps1 b/Src/Private/Get-AbrProcessDiagram.ps1 index 23c1630..ebc8e65 100644 --- a/Src/Private/Get-AbrProcessDiagram.ps1 +++ b/Src/Private/Get-AbrProcessDiagram.ps1 @@ -1,18 +1,49 @@ function Get-AbrProcessDiagram { <# .SYNOPSIS - Used by As Built Report to built process diagram + Used by As Built Report to build a process hierarchy diagram. .DESCRIPTION + Builds a Graphviz-based process hierarchy diagram showing the top 5 CPU-consuming + processes and their relationship to the host system. The diagram is constructed using + the AsBuiltReport.Diagram module's PSGraph DSL (SubGraph, Add-DiaNodeIcon, Edge). + The diagram structure: + - A single SubGraph named 'ProcessH' acts as the cluster container. + - A 'System' node represents the host machine. + - Five process nodes (one per top-5 process) show CPU and Memory usage as + additional node attributes. + - Dashed edges connect the 'System' node to each process node. + + Colour and style are determined by the DiagramTheme option: + Black - Dark background, white labels and edges. + Neon - Dark grey background, gold labels and edges. + White - Default; light-coloured edges and labels. + + When EnableDiagramDebug is true, debug styling (red dashed borders, visible edges) + is applied to all graph elements to help troubleshoot layout issues. + + This function returns the resulting Graphviz graph object, which is then passed to + Export-AbrDiagram for rendering and embedding into the report. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($Options, $reportTranslate, $Images) that are set by the AsBuiltReport + framework before this function is called. + .OUTPUTS + System.Object + Returns the Graphviz SubGraph object produced by the PSGraph DSL. The caller + (Get-AbrProcessInfo) passes this object to Export-AbrDiagram for rendering. + .EXAMPLE + # This function is called automatically by Get-AbrProcessInfo. + # It is not designed to be called directly by end users. + $diagram = Get-AbrProcessDiagram + Export-AbrDiagram -DiagramObject $diagram -MainDiagramLabel 'Process Hierarchy Diagram' -FileName 'ProcessDiagram' .NOTES Version: 0.1.2 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( @@ -21,7 +52,10 @@ function Get-AbrProcessDiagram { begin { Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'ProcessInfo', $($InfoLevel.ProcessInfo)) Write-PScriboMessage $($reportTranslate.Generating) - # Used for DiagramDebug + # Configure debug styling when EnableDiagramDebug is enabled. In debug mode, edges and + # subgraph borders are drawn in red so layout issues are easy to spot. In normal mode, + # these elements are made invisible (style = 'invis') so they do not appear in the + # final diagram output. if ($Options.EnableDiagramDebug) { $EdgeDebug = @{style = 'filled'; color = 'red' } $SubGraphDebug = @{style = 'dashed'; color = 'red' } @@ -36,6 +70,7 @@ function Get-AbrProcessDiagram { $IconDebug = $false } + # Set the edge and font colours based on the chosen diagram theme. if ($Options.DiagramTheme -eq 'Black') { $Edgecolor = 'White' $Fontcolor = 'White' @@ -50,27 +85,26 @@ function Get-AbrProcessDiagram { process { try { - # Get top 5 CPU consuming processes and build diagram + # Retrieve the top 5 CPU-consuming processes and project the properties needed for + # diagram node labels. CPU time is rounded to whole seconds; memory is in MB. $Process = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -Property @{Name = 'Name'; Expression = { "$($_.Name.Split(' ')[0]) (Id=$($_.Id))" } }, @{Name = 'CPU'; Expression = { try { [math]::Round($_.CPU, 0) } catch { '--' } } }, @{Name = 'MEM'; Expression = { try { [math]::Round($_.WorkingSet / 1MB, 0) } catch { '--' } } } -First 5 - # Subgraph is a graphviz element that allows to group nodes together. In this case we are grouping the top 5 processes - # together in a subgraph called ProcessH. Subgraph is used to create a cluster in the diagram. The cluster is styled with a - # dashed border and a label. The nodes inside the cluster are the top 5 processes. Each process node has an icon and additional - # information about CPU and Memory usage. Edges are drawn from the System node to each process node with a dashed line. + # SubGraph is a Graphviz element that groups related nodes inside a bordered cluster. + # Here the cluster contains the System node and the top 5 process nodes. + # Attributes control the cluster border style, label, font, and colour. SubGraph ProcessH -Attributes @{Label = $($reportTranslate.Label); fontsize = 28; fontcolor = $Fontcolor; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded'; color = 'gray' } { - # Add system node with icon and then add process nodes with icons and additional info. - # Add-DiaNodeIcon is a custom function that adds an icon to the node. It takes parameters for the name of the node, - # whether to include debug styling, the type of icon to use, the images object that contains the icons, and the node - # object to add the icon to. For process nodes, additional info about CPU and Memory usage is added as well. + # Add the System node to the diagram. Add-DiaNodeIcon is a helper from the + # AsBuiltReport.Diagram module that renders a node with an icon image sourced + # from the $Images hashtable. Add-DiaNodeIcon -Name 'System' -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject - # Add process nodes with icons and additional info about CPU and Memory usage. The process name is simplified to remove extra information. + # Add one node per top-5 process. Each node shows the process name (including PID) + # as well as additional info attributes for CPU and Memory usage. $Process | ForEach-Object { Add-DiaNodeIcon -Name $_.Name -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject -AditionalInfo @{'CPU Usage' = $_.CPU; 'Memory Usage' = $_.MEM } } - # Edge is a graphviz element that represents a connection between two nodes. In this case, we are adding edges from the System node - # to each process node. The edges are styled with a dashed line and a specific color based on the diagram theme. - # The pen width is set to 1.5 for better visibility. + # Draw a dashed edge from the System node to each process node to represent the + # parent-child relationship. Edge colour and width follow the active theme. $Process | ForEach-Object { Edge -From 'System' -To $_.Name -Attributes @{color = $Edgecolor; style = 'dashed'; penwidth = 1.5; } } } } catch { diff --git a/Src/Private/Get-AbrProcessInfo.ps1 b/Src/Private/Get-AbrProcessInfo.ps1 index be65fe6..505562d 100644 --- a/Src/Private/Get-AbrProcessInfo.ps1 +++ b/Src/Private/Get-AbrProcessInfo.ps1 @@ -2,24 +2,57 @@ function Get-AbrProcessInfo { <# .SYNOPSIS - Used by As Built Report to retrieve system process information + Used by As Built Report to retrieve system process information. .DESCRIPTION + Collects the top 5 CPU-consuming processes running on the local system using + Get-Process, sorted in descending order by CPU time. For each process the following + fields are captured: + - Name : The process executable name (first token, without arguments). + - Id : The operating system process identifier (PID). + - CPU (%) : Cumulative CPU time rounded to the nearest second. + - Memory (MB): Working set memory rounded to the nearest megabyte. + - Company : The company name embedded in the executable metadata, if available. + - Product : The product name embedded in the executable metadata, if available. + + After the tabular data, two bar charts are generated (CPU usage and Memory usage) using + the AsBuiltReport.Chart module's New-BarChart cmdlet. Finally, a process hierarchy + diagram is produced by calling Get-AbrProcessDiagram and exported via Export-AbrDiagram. + + The level of detail in the output is controlled by the InfoLevel.ProcessInfo setting + in the report configuration JSON: + + 0 - Disabled. The section is skipped entirely. + 1 - Summary. A compact table of all top-5 processes with key columns only. + 2 - Detailed. A per-process subsection with a full list-style table. + + Localization is handled through the $reportTranslate variable, which is populated by + AsBuiltReport.Core from the appropriate Language/*.psd1 file. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($InfoLevel, $reportTranslate, $Report, $System) that are set by the + AsBuiltReport framework before this function is called. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section, Table, + Paragraph, BlankLine, and Image cmdlets. + .EXAMPLE + # This function is called automatically by Invoke-AsBuiltReport.System.Resources. + # It is not designed to be called directly by end users. + Get-AbrProcessInfo .NOTES Version: 0.1.2 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( ) begin { + # Narrow the translation lookup to the GetAbrProcessInfo section of the language data. $reportTranslate = $reportTranslate.GetAbrProcessInfo Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'ProcessInfo', $($InfoLevel.ProcessInfo)) } @@ -27,16 +60,24 @@ function Get-AbrProcessInfo { process { try { if ($InfoLevel.ProcessInfo -gt 0) { + # Retrieve the top 5 processes sorted by descending CPU time. $SystemProcess = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 5 if ($SystemProcess) { Write-PScriboMessage $reportTranslate.Collecting Section -Style Heading2 $($reportTranslate.Heading) { + # Build an array of ordered hashtables so column order is preserved when + # converting to PSCustomObjects for the PScribo Table cmdlet. + # Translated keys are used throughout so that the table headers match the + # active report language regardless of which locale is configured. $SystemProcessInfo = @() foreach ($Process in $SystemProcess) { $InObj = [Ordered]@{ + # Strip any argument suffix from the process name (split on space, take first token). $($reportTranslate.Name) = $Process.ProcessName.Split(' ')[0] $($reportTranslate.Id) = $Process.Id + # Round CPU time to whole seconds; fall back to '--' on error (e.g. access denied). $($reportTranslate.CPU) = & { try { [math]::Round($Process.CPU, 0) } catch { '--' } } + # Convert working set bytes to MB; fall back to '--' on error. $($reportTranslate.Memory) = & { try { [math]::Round($Process.WorkingSet / 1MB, 0) } catch { '--' } } $($reportTranslate.Company) = switch ([string]::IsNullOrEmpty($Process.Company)) { $true { '--' } @@ -53,11 +94,14 @@ function Get-AbrProcessInfo { } if ($InfoLevel.ProcessInfo -ge 2) { + # InfoLevel 2: render each process as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail foreach ($Process in $SystemProcessInfo) { + # Use the translated Name key to read the process name property, ensuring + # the section heading is correct in all supported locales. Section -Style NOTOCHeading4 -ExcludeFromTOC "$($Process.($reportTranslate.Name))" { $TableParams = @{ - Name = "$($reportTranslate.Heading) - $($Process.Name)" + Name = "$($reportTranslate.Heading) - $($Process.($reportTranslate.Name))" List = $true ColumnWidths = 40, 60 } @@ -68,6 +112,7 @@ function Get-AbrProcessInfo { } } } else { + # InfoLevel 1: render a single compact table with the most useful columns only. Paragraph $reportTranslate.ParagraphSummary BlankLine $TableParams = @{ @@ -81,6 +126,7 @@ function Get-AbrProcessInfo { } $SystemProcessInfo | Table @TableParams } + # Generate a bar chart showing CPU usage for the top 5 processes. try { $Chart = New-BarChart -Values $SystemProcessInfo.$($reportTranslate.CPU) -Labels $SystemProcessInfo.$($reportTranslate.Name) -Title $reportTranslate.CPUUsage -EnableLegend -LegendOrientation Horizontal -LegendAlignment UpperCenter -Width 600 -Height 600 -Format base64 -LabelYAxis $($reportTranslate.CPU) -LabelXAxis $($reportTranslate.Processes) -TitleFontSize 20 -TitleFontBold -AreaOrientation Vertical -EnableCustomColorPalette -CustomColorPalette @('#395879', '#59779a', '#7b98bc', '#9dbae0', '#c0ddff') -AxesMarginsTop 0.5 if ($Chart) { @@ -91,6 +137,7 @@ function Get-AbrProcessInfo { } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } + # Generate a bar chart showing memory usage for the top 5 processes. try { $Chart = New-BarChart -Values $SystemProcessInfo.$($reportTranslate.Memory) -Labels $SystemProcessInfo.$($reportTranslate.Name) -Title $reportTranslate.MEMUsage -EnableLegend -LegendOrientation Horizontal -LegendAlignment UpperCenter -Width 600 -Height 600 -Format base64 -LabelYAxis $($reportTranslate.Memory) -LabelXAxis $($reportTranslate.Processes) -TitleFontSize 20 -TitleFontBold -AreaOrientation Vertical -EnableCustomColorPalette -CustomColorPalette @('#395879', '#59779a', '#7b98bc', '#9dbae0', '#c0ddff') -AxesMarginsTop 0.5 if ($Chart) { @@ -101,6 +148,7 @@ function Get-AbrProcessInfo { } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } + # Generate and embed the process hierarchy diagram. try { $ProcessDiagram = Get-AbrProcessDiagram if ($ProcessDiagram) { diff --git a/Src/Private/Get-AbrTimeZone.ps1 b/Src/Private/Get-AbrTimeZone.ps1 index c8ab060..24c7552 100644 --- a/Src/Private/Get-AbrTimeZone.ps1 +++ b/Src/Private/Get-AbrTimeZone.ps1 @@ -1,24 +1,52 @@ function Get-AbrTimeZone { <# .SYNOPSIS - Used by As Built Report to retrieve system timezone information + Used by As Built Report to retrieve system timezone information. .DESCRIPTION + Queries the local system's timezone configuration using the Get-TimeZone cmdlet and + renders the results into the report using PScribo cmdlets. The following fields are + captured for each timezone: + - TimeZone ID (e.g. 'Pacific Standard Time') + - DisplayName (e.g. '(UTC-08:00) Pacific Time (US & Canada)') + - Current Time (snapshot of the time when the report is generated) + - Base UTC Offset (e.g. '-08:00:00') + - Supports Daylight Saving Time (Yes / No) + + The level of detail in the output is controlled by the InfoLevel.TimeZone setting in + the report configuration JSON: + + 0 - Disabled. The section is skipped entirely. + 1 - Summary. A single compact table showing all fields for all targets. + 2 - Detailed. A per-target subsection with a list-style table. + + Localization is handled through the $reportTranslate variable, which is populated by + AsBuiltReport.Core from the appropriate Language/*.psd1 file. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($InfoLevel, $reportTranslate, $Report, $System) that are set by the + AsBuiltReport framework before this function is called. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section, Table, + Paragraph, and BlankLine cmdlets. + .EXAMPLE + # This function is called automatically by Invoke-AsBuiltReport.System.Resources. + # It is not designed to be called directly by end users. + Get-AbrTimeZone .NOTES Version: 0.1.1 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( ) begin { + # Narrow the translation lookup to the GetAbrTimeZone section of the language data. $reportTranslate = $reportTranslate.GetAbrTimeZone Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'TimeZone', $($InfoLevel.TimeZone)) } @@ -30,11 +58,14 @@ function Get-AbrTimeZone { if ($SystemTimeZone) { Write-PScriboMessage $reportTranslate.Collecting Section -Style Heading2 $($reportTranslate.Heading) { + # Build an array of ordered hashtables so column order is preserved when + # converting to PSCustomObjects for the PScribo Table cmdlet. $SystemTimeZoneInfo = @() foreach ($TimeZone in $SystemTimeZone) { $InObj = [Ordered]@{ $($reportTranslate.TimeZone) = $TimeZone.Id $($reportTranslate.DisplayName) = $TimeZone.DisplayName + # Capture the current time at report-generation time for reference. $($reportTranslate.CurrentTime) = Get-Date -DisplayHint Time $($reportTranslate.BaseUTCOffset) = $TimeZone.BaseUtcOffset $($reportTranslate.SupportsDaylightSavingTime) = switch ($TimeZone.SupportsDaylightSavingTime) { @@ -47,6 +78,7 @@ function Get-AbrTimeZone { } if ($InfoLevel.TimeZone -ge 2) { + # InfoLevel 2: render each target as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail foreach ($TimeZoneInfo in $SystemTimeZoneInfo) { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($System)" { @@ -62,6 +94,7 @@ function Get-AbrTimeZone { } } } else { + # InfoLevel 1: render a single compact table across all targets. Paragraph $reportTranslate.ParagraphSummary BlankLine $TableParams = @{ diff --git a/Src/Private/Get-AbrUptime.ps1 b/Src/Private/Get-AbrUptime.ps1 index 60219df..9de55c8 100644 --- a/Src/Private/Get-AbrUptime.ps1 +++ b/Src/Private/Get-AbrUptime.ps1 @@ -2,24 +2,57 @@ function Get-AbrUptime { <# .SYNOPSIS - Used by As Built Report to retrieve system uptime information + Used by As Built Report to retrieve system uptime information. .DESCRIPTION + Determines how long the system has been running since the last boot and renders the + result into the report using PScribo cmdlets. The uptime retrieval method varies by + PowerShell edition: + PowerShell Core (PSEdition = 'Core'): + Uses the built-in Get-Uptime cmdlet, available in PowerShell 6 and later on + Windows, Linux, and macOS. + + Windows PowerShell (PSEdition = 'Desktop'): + Uses the private Get-SystemUptime helper function, which queries WMI + (Win32_OperatingSystem.LastBootUpTime) because Get-Uptime is not available + on PowerShell 5.x. + + Uptime is formatted as 'XhYmZs' (e.g. '03h 45m 12s') for readability. + + The level of detail in the output is controlled by the InfoLevel.Uptime setting in + the report configuration JSON: + + 0 - Disabled. The section is skipped entirely. + 1 - Summary. A single compact table showing Uptime for all targets. + 2 - Detailed. A per-target subsection with a list-style table. + + Localization is handled through the $reportTranslate variable, which is populated by + AsBuiltReport.Core from the appropriate Language/*.psd1 file. + .INPUTS + None. This function does not accept pipeline input. It reads from script-scoped + variables ($InfoLevel, $reportTranslate, $Report, $System, $PSVersionTable) that are + set by the AsBuiltReport framework before this function is called. + .OUTPUTS + None. Output is written directly to the PScribo document object via Section, Table, + Paragraph, and BlankLine cmdlets. + .EXAMPLE + # This function is called automatically by Invoke-AsBuiltReport.System.Resources. + # It is not designed to be called directly by end users. + Get-AbrUptime .NOTES Version: 0.1.1 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] param ( ) begin { + # Narrow the translation lookup to the GetAbrUptime section of the language data. $reportTranslate = $reportTranslate.GetAbrUptime Write-PScriboMessage ($($reportTranslate.InfoLevel) -f 'Uptime', $($InfoLevel.Uptime)) } @@ -27,6 +60,9 @@ function Get-AbrUptime { process { try { if ($InfoLevel.Uptime -gt 0) { + # Choose the uptime retrieval method based on the PowerShell edition in use. + # Get-Uptime is only available in PowerShell Core (6+), so Windows PowerShell + # (5.x Desktop edition) falls back to the WMI-based Get-SystemUptime helper. $SystemUptime = switch ($PSVersionTable.PSEdition) { 'Core' { Get-Uptime } 'Desktop' { Get-SystemUptime } @@ -35,15 +71,19 @@ function Get-AbrUptime { if ($SystemUptime) { Write-PScriboMessage $reportTranslate.Collecting Section -Style Heading2 $($reportTranslate.Heading) { + # Build an array of ordered hashtables so column order is preserved when + # converting to PSCustomObjects for the PScribo Table cmdlet. $SystemUptimeInfo = @() foreach ($Uptime in $SystemUptime) { $InObj = [Ordered]@{ + # Format the TimeSpan as 'XhYmZs' for a concise, readable output. $($reportTranslate.Uptime) = $Uptime.ToString("hh'h 'mm'm 'ss's'") } $SystemUptimeInfo += [PSCustomObject]$InObj } if ($InfoLevel.Uptime -ge 2) { + # InfoLevel 2: render each target as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail foreach ($UptimeInfo in $SystemUptimeInfo) { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($System)" { @@ -59,6 +99,7 @@ function Get-AbrUptime { } } } else { + # InfoLevel 1: render a single compact table across all targets. Paragraph $reportTranslate.ParagraphSummary BlankLine $TableParams = @{ diff --git a/Src/Private/Get-SystemUptime.ps1 b/Src/Private/Get-SystemUptime.ps1 index e12e2c6..42f8a99 100644 --- a/Src/Private/Get-SystemUptime.ps1 +++ b/Src/Private/Get-SystemUptime.ps1 @@ -1,18 +1,29 @@ function Get-SystemUptime { <# .SYNOPSIS - Used by As Built Report to retrieve last boot uptime information + Used by As Built Report to retrieve last boot uptime information. .DESCRIPTION - + Calculates the system uptime on Windows PowerShell (Desktop edition) by querying the + Win32_OperatingSystem WMI class for the LastBootUpTime property, then subtracting that + value from the current date/time to produce a TimeSpan. This helper function is called + by Get-AbrUptime when running on Windows PowerShell 5.x, which does not have the + built-in Get-Uptime cmdlet available in PowerShell Core 6+. + .INPUTS + None. This function does not accept pipeline input. + .OUTPUTS + System.TimeSpan + Returns a TimeSpan object representing the duration the system has been running since + the last boot. + .EXAMPLE + Get-SystemUptime + Returns a TimeSpan such as '3.04:12:45.1234567' representing time since last boot. .NOTES Version: 0.1.1 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport - .EXAMPLE - .LINK - + https://github.com/AsBuiltReport/AsBuiltReport.System.Resources #> [CmdletBinding()] [OutputType([TimeSpan])] @@ -22,9 +33,12 @@ function Get-SystemUptime { begin {} process { - $operatingSystem = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object LastBootUpTime - $Uptime = "$((Get-Date) - ($operatingSystem.LastBootUpTime))" - return [TimeSpan]$Uptime + # Query the WMI Win32_OperatingSystem class to get the time of the last system boot. + # This approach is used on Windows PowerShell (Desktop edition) because Get-Uptime is + # only available in PowerShell Core (PSEdition = 'Core'). + $operatingSystem = Get-CimInstance -ClassName Win32_OperatingSystem + # Subtract the last boot time from the current time to calculate the uptime duration. + return (Get-Date) - $operatingSystem.LastBootUpTime } end {} diff --git a/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 b/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 index 1ff2d51..a3658bc 100644 --- a/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 @@ -1,9 +1,54 @@ function Invoke-AsBuiltReport.System.Resources { <# .SYNOPSIS - PowerShell script to document the configuration of System Resources in Word/HTML/Text formats + PowerShell script to document the configuration of System Resources in Word/HTML/Text formats. .DESCRIPTION - Documents the configuration of System Resources in Word/HTML/Text formats using PScribo. + Generates an As Built Report for the local system's resources by orchestrating a + series of data-collection functions, each of which appends a section to the active + PScribo document. The following sections are produced (subject to InfoLevel settings): + + - Date : Current system date and time (Get-AbrDate). + - TimeZone : Configured timezone details (Get-AbrTimeZone). + - Uptime : Time elapsed since last system boot (Get-AbrUptime). + - PSHost : PowerShell host name, version, and culture (Get-AbrPSHost). + - ProcessInfo : Top 5 CPU-consuming processes with charts and diagram + (Get-AbrProcessInfo). + + Each section respects the InfoLevel value (0-2) defined for it in the report + configuration JSON file: + + 0 - Section disabled entirely. + 1 - Summary table only. + 2 - Detailed per-target subsections. + + Report configuration is read from $ReportConfig (populated by AsBuiltReport.Core) + and split into: + $Report - General report metadata (ShowTableCaptions, ShowTableOfContents, etc.). + $InfoLevel - Granularity settings for each section. + $Options - Feature flags (EnableDiagrams, DiagramTheme, ExportDiagrams, etc.). + + The $Target parameter accepts one or more system names. Each name is used as a + Heading1 section label. In this proof-of-concept module, data is always collected + from the local machine regardless of the target value. + .PARAMETER Target + One or more target system names. Each name becomes a top-level Heading1 section in + the report. The value is typically the hostname but can be any descriptive string. + Provided by the AsBuiltReport.Core framework at report generation time. + .PARAMETER Credential + A PSCredential object for authenticating to remote systems. Included for framework + compatibility; not currently used as this module collects data from the local machine. + .INPUTS + None. Parameters are supplied by the AsBuiltReport.Core framework when + New-AsBuiltReport is invoked. + .OUTPUTS + None. All output is written to the PScribo document object managed by + AsBuiltReport.Core, which then renders it to the chosen output format. + .EXAMPLE + # Generate a report for the local machine using the default JSON configuration: + New-AsBuiltReport -Report System.Resources -Target 'localhost' -OutputFolderPath 'C:\Reports' + .EXAMPLE + # Generate a Word document with a custom report name: + New-AsBuiltReport -Report System.Resources -Target $env:COMPUTERNAME -Format Word -OutputFolderPath 'C:\Reports' -ReportConfigFilePath 'C:\Configs\MyReport.json' .NOTES Version: 0.1.2 Author: AsBuiltReport Community @@ -36,7 +81,8 @@ function Invoke-AsBuiltReport.System.Resources { # Used to set values to TitleCase where required $TextInfo = (Get-Culture).TextInfo - # Used to set diagrams icon images + # Map logical icon names to their physical PNG filenames in the module's 'icons' folder. + # These are used by the diagram builder functions via the $Images variable. $script:Images = @{ 'AsBuiltReport_LOGO' = 'AsBuiltReport_Logo.png' 'AsBuiltReport_Signature' = 'AsBuiltReport_Signature.png' @@ -45,6 +91,9 @@ function Invoke-AsBuiltReport.System.Resources { } #region foreach loop + # Iterate over each target system. Each target produces a top-level Heading1 section. + # Note: in the current implementation all data is collected from the local machine; + # the $System variable is used for report labelling purposes only. foreach ($System in $Target) { Section -Style Heading1 "$($System.ToUpper())" { Get-AbrDate From a5aa514ccf821f73eee3a08c918591785d015a1d Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Mon, 16 Mar 2026 14:24:15 -0400 Subject: [PATCH 04/13] ## [0.1.3] - 2026-03-?? ### Changed - Migrate Diagrammer.Core to AsBuiltReport.Diagram for better integration and maintenance - Update module dependencies to reflect the change - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core - Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements - Bump AsBuiltReport.Diagram to version 1.0.2 to include latest diagramming features and improvements - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance --- .github/workflows/Release.yml | 112 +++++++++--------- .../AsBuiltReport.System.Resources.Style.ps1 | 0 .../AsBuiltReport.System.Resources.json | 0 .../AsBuiltReport.System.Resources.psd1 | 2 +- .../AsBuiltReport.System.Resources.psm1 | 0 .../Icons}/AsBuiltReport_Logo.png | Bin .../Icons}/AsBuiltReport_Signature.png | Bin .../Icons}/Process.png | Bin .../Icons}/no_icon.png | Bin .../Language}/ar-SA/SystemResources.psd1 | 0 .../Language}/cs-CZ/SystemResources.psd1 | 0 .../Language}/da-DK/SystemResources.psd1 | 0 .../Language}/de-DE/SystemResources.psd1 | 0 .../Language}/el-GR/SystemResources.psd1 | 0 .../Language}/en-GB/SystemResources.psd1 | 0 .../Language}/en-US/SystemResources.psd1 | 0 .../Language}/es-ES/SystemResources.psd1 | 0 .../Language}/fi-FI/SystemResources.psd1 | 0 .../Language}/fr-FR/SystemResources.psd1 | 0 .../Language}/he-IL/SystemResources.psd1 | 0 .../Language}/hi-IN/SystemResources.psd1 | 0 .../Language}/hu-HU/SystemResources.psd1 | 0 .../Language}/it-IT/SystemResources.psd1 | 0 .../Language}/ja-JP/SystemResources.psd1 | 0 .../Language}/ko-KR/SystemResources.psd1 | 0 .../Language}/nb-NO/SystemResources.psd1 | 0 .../Language}/nl-NL/SystemResources.psd1 | 0 .../Language}/pl-PL/SystemResources.psd1 | 0 .../Language}/pt-PT/SystemResources.psd1 | 0 .../Language}/ru-RU/SystemResources.psd1 | 0 .../Language}/sv-SE/SystemResources.psd1 | 0 .../Language}/th-TH/SystemResources.psd1 | 0 .../Language}/tr-TR/SystemResources.psd1 | 0 .../Language}/vi-VN/SystemResources.psd1 | 0 .../Language}/zh-CN/SystemResources.psd1 | 0 .../Language}/zh-Hans/SystemResources.psd1 | 0 .../Language}/zh-Hant/SystemResources.psd1 | 0 .../Src}/Private/Export-AbrDiagram.ps1 | 12 +- .../Src}/Private/Get-AbrDate.ps1 | 0 .../Src}/Private/Get-AbrPSHost.ps1 | 0 .../Src}/Private/Get-AbrProcessDiagram.ps1 | 8 +- .../Src}/Private/Get-AbrProcessInfo.ps1 | 4 +- .../Src}/Private/Get-AbrTimeZone.ps1 | 0 .../Src}/Private/Get-AbrUptime.ps1 | 0 .../Src}/Private/Get-SystemUptime.ps1 | 0 .../Invoke-AsBuiltReport.System.Resources.ps1 | 0 CHANGELOG.md | 3 + 47 files changed, 72 insertions(+), 69 deletions(-) rename AsBuiltReport.System.Resources.Style.ps1 => AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.Style.ps1 (100%) rename AsBuiltReport.System.Resources.json => AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json (100%) rename AsBuiltReport.System.Resources.psd1 => AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 (99%) rename AsBuiltReport.System.Resources.psm1 => AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psm1 (100%) rename {icons => AsBuiltReport.System.Resources/Icons}/AsBuiltReport_Logo.png (100%) rename {icons => AsBuiltReport.System.Resources/Icons}/AsBuiltReport_Signature.png (100%) rename {icons => AsBuiltReport.System.Resources/Icons}/Process.png (100%) rename {icons => AsBuiltReport.System.Resources/Icons}/no_icon.png (100%) rename {Language => AsBuiltReport.System.Resources/Language}/ar-SA/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/cs-CZ/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/da-DK/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/de-DE/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/el-GR/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/en-GB/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/en-US/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/es-ES/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/fi-FI/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/fr-FR/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/he-IL/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/hi-IN/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/hu-HU/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/it-IT/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/ja-JP/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/ko-KR/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/nb-NO/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/nl-NL/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/pl-PL/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/pt-PT/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/ru-RU/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/sv-SE/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/th-TH/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/tr-TR/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/vi-VN/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/zh-CN/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/zh-Hans/SystemResources.psd1 (100%) rename {Language => AsBuiltReport.System.Resources/Language}/zh-Hant/SystemResources.psd1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Export-AbrDiagram.ps1 (96%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrDate.ps1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrPSHost.ps1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrProcessDiagram.ps1 (91%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrProcessInfo.ps1 (99%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrTimeZone.ps1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-AbrUptime.ps1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Private/Get-SystemUptime.ps1 (100%) rename {Src => AsBuiltReport.System.Resources/Src}/Public/Invoke-AsBuiltReport.System.Resources.ps1 (100%) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 58961d2..ac066db 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -1,61 +1,61 @@ name: Publish PowerShell Module on: - release: - types: [published] + release: + types: [published] jobs: - publish-to-gallery: - runs-on: windows-latest - steps: - - uses: actions/checkout@v6 - - name: Set PSRepository to Trusted for PowerShell Gallery - shell: pwsh - run: | - Set-PSRepository -Name PSGallery -InstallationPolicy Trusted - - name: Install AsBuiltReport.Core module - shell: pwsh - run: | - Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force - - name: Install AsBuiltReport.Chart module - shell: pwsh - run: | - Install-Module -Name AsBuiltReport.Chart -Repository PSGallery -Force - - name: Install Diagrammer.Core module - shell: pwsh - run: | - Install-Module -Name Diagrammer.Core -Repository PSGallery -Force - - name: Test Module Manifest - shell: pwsh - run: | - Test-ModuleManifest .\AsBuiltReport.System.Resources.psd1 - - name: Publish module to PowerShell Gallery - shell: pwsh - run: | - Publish-Module -Path ./ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose - tweet: - needs: publish-to-gallery - runs-on: ubuntu-latest - steps: - - uses: Eomm/why-don-t-you-tweet@v2 - # We don't want to tweet if the repository is not a public one - if: ${{ !github.event.repository.private }} - with: - # GitHub event payload - # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release - tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #System #Resources #AsBuiltReport #PowerShell" - env: - TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }} - TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} - TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} - TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} - bsky-post: - needs: publish-to-gallery - runs-on: ubuntu-latest - steps: - - uses: zentered/bluesky-post-action@v0.3.0 - with: - post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #System #Resources #AsBuiltReport #PowerShell" - env: - BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }} - BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }} + publish-to-gallery: + runs-on: windows-latest + steps: + - uses: actions/checkout@v6 + - name: Set PSRepository to Trusted for PowerShell Gallery + shell: pwsh + run: | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + - name: Install AsBuiltReport.Core module + shell: pwsh + run: | + Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force + - name: Install AsBuiltReport.Chart module + shell: pwsh + run: | + Install-Module -Name AsBuiltReport.Chart -Repository PSGallery -Force + - name: Install AsBuiltReport.Diagram module + shell: pwsh + run: | + Install-Module -Name AsBuiltReport.Diagram -Repository PSGallery -Force + - name: Test Module Manifest + shell: pwsh + run: | + Test-ModuleManifest .\AsBuiltReport.System.Resources\AsBuiltReport.System.Resources.psd1 + - name: Publish module to PowerShell Gallery + shell: pwsh + run: | + Publish-Module -Path .\AsBuiltReport.System.Resources\ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose + tweet: + needs: publish-to-gallery + runs-on: ubuntu-latest + steps: + - uses: Eomm/why-don-t-you-tweet@v2 + # We don't want to tweet if the repository is not a public one + if: ${{ !github.event.repository.private }} + with: + # GitHub event payload + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release + tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #System #Resources #AsBuiltReport #PowerShell" + env: + TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }} + TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} + TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + bsky-post: + needs: publish-to-gallery + runs-on: ubuntu-latest + steps: + - uses: zentered/bluesky-post-action@v0.4.0 + with: + post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #System #Resources #AsBuiltReport #PowerShell" + env: + BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }} + BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }} diff --git a/AsBuiltReport.System.Resources.Style.ps1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.Style.ps1 similarity index 100% rename from AsBuiltReport.System.Resources.Style.ps1 rename to AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.Style.ps1 diff --git a/AsBuiltReport.System.Resources.json b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json similarity index 100% rename from AsBuiltReport.System.Resources.json rename to AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json diff --git a/AsBuiltReport.System.Resources.psd1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 similarity index 99% rename from AsBuiltReport.System.Resources.psd1 rename to AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 index db373a9..a89d30f 100644 --- a/AsBuiltReport.System.Resources.psd1 +++ b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 @@ -63,7 +63,7 @@ }, @{ ModuleName = 'AsBuiltReport.Diagram'; - ModuleVersion = '1.0.0' + ModuleVersion = '1.0.2' } ) diff --git a/AsBuiltReport.System.Resources.psm1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psm1 similarity index 100% rename from AsBuiltReport.System.Resources.psm1 rename to AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psm1 diff --git a/icons/AsBuiltReport_Logo.png b/AsBuiltReport.System.Resources/Icons/AsBuiltReport_Logo.png similarity index 100% rename from icons/AsBuiltReport_Logo.png rename to AsBuiltReport.System.Resources/Icons/AsBuiltReport_Logo.png diff --git a/icons/AsBuiltReport_Signature.png b/AsBuiltReport.System.Resources/Icons/AsBuiltReport_Signature.png similarity index 100% rename from icons/AsBuiltReport_Signature.png rename to AsBuiltReport.System.Resources/Icons/AsBuiltReport_Signature.png diff --git a/icons/Process.png b/AsBuiltReport.System.Resources/Icons/Process.png similarity index 100% rename from icons/Process.png rename to AsBuiltReport.System.Resources/Icons/Process.png diff --git a/icons/no_icon.png b/AsBuiltReport.System.Resources/Icons/no_icon.png similarity index 100% rename from icons/no_icon.png rename to AsBuiltReport.System.Resources/Icons/no_icon.png diff --git a/Language/ar-SA/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 similarity index 100% rename from Language/ar-SA/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 diff --git a/Language/cs-CZ/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 similarity index 100% rename from Language/cs-CZ/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 diff --git a/Language/da-DK/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 similarity index 100% rename from Language/da-DK/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 diff --git a/Language/de-DE/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 similarity index 100% rename from Language/de-DE/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 diff --git a/Language/el-GR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 similarity index 100% rename from Language/el-GR/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 diff --git a/Language/en-GB/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 similarity index 100% rename from Language/en-GB/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 diff --git a/Language/en-US/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 similarity index 100% rename from Language/en-US/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 diff --git a/Language/es-ES/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 similarity index 100% rename from Language/es-ES/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 diff --git a/Language/fi-FI/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 similarity index 100% rename from Language/fi-FI/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 diff --git a/Language/fr-FR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 similarity index 100% rename from Language/fr-FR/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 diff --git a/Language/he-IL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 similarity index 100% rename from Language/he-IL/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 diff --git a/Language/hi-IN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 similarity index 100% rename from Language/hi-IN/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 diff --git a/Language/hu-HU/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 similarity index 100% rename from Language/hu-HU/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 diff --git a/Language/it-IT/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 similarity index 100% rename from Language/it-IT/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 diff --git a/Language/ja-JP/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 similarity index 100% rename from Language/ja-JP/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 diff --git a/Language/ko-KR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 similarity index 100% rename from Language/ko-KR/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 diff --git a/Language/nb-NO/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 similarity index 100% rename from Language/nb-NO/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 diff --git a/Language/nl-NL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 similarity index 100% rename from Language/nl-NL/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 diff --git a/Language/pl-PL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 similarity index 100% rename from Language/pl-PL/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 diff --git a/Language/pt-PT/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 similarity index 100% rename from Language/pt-PT/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 diff --git a/Language/ru-RU/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 similarity index 100% rename from Language/ru-RU/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 diff --git a/Language/sv-SE/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 similarity index 100% rename from Language/sv-SE/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 diff --git a/Language/th-TH/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 similarity index 100% rename from Language/th-TH/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 diff --git a/Language/tr-TR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 similarity index 100% rename from Language/tr-TR/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 diff --git a/Language/vi-VN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 similarity index 100% rename from Language/vi-VN/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 diff --git a/Language/zh-CN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 similarity index 100% rename from Language/zh-CN/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 diff --git a/Language/zh-Hans/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 similarity index 100% rename from Language/zh-Hans/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 diff --git a/Language/zh-Hant/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 similarity index 100% rename from Language/zh-Hant/SystemResources.psd1 rename to AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 diff --git a/Src/Private/Export-AbrDiagram.ps1 b/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 similarity index 96% rename from Src/Private/Export-AbrDiagram.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 index 312b8f0..59223a6 100644 --- a/Src/Private/Export-AbrDiagram.ps1 +++ b/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 @@ -44,9 +44,9 @@ function Export-AbrDiagram { .EXAMPLE # Typically called from within a report section function such as Get-AbrProcessInfo: $diagram = Get-AbrProcessDiagram - Export-AbrDiagram -DiagramObject $diagram -MainDiagramLabel 'Process Hierarchy Diagram' -FileName 'AsBuiltReport.System.Resources.Cluster' + Export-AbrDiagram -DiagramObject $diagram -MainDiagramLabel 'Process Hierarchy Diagram' -FileName 'AsBuiltReport.System.Resources' .NOTES - Version: 0.1.2 + Version: 0.1.3 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport @@ -77,7 +77,7 @@ function Export-AbrDiagram { # Resolve the icons directory relative to the module root so that icon images can # be embedded into diagram nodes by New-Diagrammer. $RootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent - [System.IO.FileInfo]$IconPath = Join-Path -Path $RootPath -ChildPath 'icons' + [System.IO.FileInfo]$IconPath = Join-Path -Path $RootPath -ChildPath 'Icons' # Build the core parameter set shared by all New-Diagrammer invocations. $DiagramParams = @{ @@ -144,7 +144,7 @@ function Export-AbrDiagram { $Graph = $DiagramObject if ($Graph) { Write-PScriboMessage -Message "Saving $MainDiagramLabel diagram" - $Diagram = New-Diagrammer @DiagramParams -InputObject $Graph + $Diagram = New-AbrDiagram @DiagramParams -InputObject $Graph if ($Diagram) { foreach ($OutputFormat in $DiagramFormat) { Write-Information -MessageData "Saved '$($FileName).$($OutputFormat)' diagram to '$($OutputFolderPath)'." -InformationAction Continue @@ -162,9 +162,9 @@ function Export-AbrDiagram { $DiagramParams.Add('Format', 'base64') $Graph = $DiagramObject - $Diagram = New-Diagrammer @DiagramParams -InputObject $Graph + $Diagram = New-AbrDiagram @DiagramParams -InputObject $Graph if ($Diagram) { - $BestAspectRatio = Get-DiaBestImageAspectRatio -GraphObj $Diagram -MaxWidth 600 + $BestAspectRatio = Get-BestImageAspectRatio -GraphObj $Diagram -MaxWidth 600 Section -Style Heading3 $MainDiagramLabel { Image -Base64 $Diagram -Text "$MainDiagramLabel Diagram" -Width $BestAspectRatio.Width -Height $BestAspectRatio.Height -Align Center } diff --git a/Src/Private/Get-AbrDate.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrDate.ps1 similarity index 100% rename from Src/Private/Get-AbrDate.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrDate.ps1 diff --git a/Src/Private/Get-AbrPSHost.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrPSHost.ps1 similarity index 100% rename from Src/Private/Get-AbrPSHost.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrPSHost.ps1 diff --git a/Src/Private/Get-AbrProcessDiagram.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessDiagram.ps1 similarity index 91% rename from Src/Private/Get-AbrProcessDiagram.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessDiagram.ps1 index ebc8e65..4c34d04 100644 --- a/Src/Private/Get-AbrProcessDiagram.ps1 +++ b/AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessDiagram.ps1 @@ -38,7 +38,7 @@ function Get-AbrProcessDiagram { $diagram = Get-AbrProcessDiagram Export-AbrDiagram -DiagramObject $diagram -MainDiagramLabel 'Process Hierarchy Diagram' -FileName 'ProcessDiagram' .NOTES - Version: 0.1.2 + Version: 0.1.3 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport @@ -97,15 +97,15 @@ function Get-AbrProcessDiagram { # Add the System node to the diagram. Add-DiaNodeIcon is a helper from the # AsBuiltReport.Diagram module that renders a node with an icon image sourced # from the $Images hashtable. - Add-DiaNodeIcon -Name 'System' -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject + Add-NodeIcon -Name 'System' -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject # Add one node per top-5 process. Each node shows the process name (including PID) # as well as additional info attributes for CPU and Memory usage. - $Process | ForEach-Object { Add-DiaNodeIcon -Name $_.Name -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject -AditionalInfo @{'CPU Usage' = $_.CPU; 'Memory Usage' = $_.MEM } } + $Process | ForEach-Object { Add-NodeIcon -Name $_.Name -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject -AditionalInfo @{'CPU Usage' = $_.CPU; 'Memory Usage' = $_.MEM } } # Draw a dashed edge from the System node to each process node to represent the # parent-child relationship. Edge colour and width follow the active theme. - $Process | ForEach-Object { Edge -From 'System' -To $_.Name -Attributes @{color = $Edgecolor; style = 'dashed'; penwidth = 1.5; } } + $Process | ForEach-Object { Add-NodeEdge -From 'System' -To $_.Name -EdgeStyle 'dashed' -EdgeColor $Edgecolor -EdgeThickness 2 } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message diff --git a/Src/Private/Get-AbrProcessInfo.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessInfo.ps1 similarity index 99% rename from Src/Private/Get-AbrProcessInfo.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessInfo.ps1 index 505562d..c5c5213 100644 --- a/Src/Private/Get-AbrProcessInfo.ps1 +++ b/AsBuiltReport.System.Resources/Src/Private/Get-AbrProcessInfo.ps1 @@ -40,7 +40,7 @@ function Get-AbrProcessInfo { # It is not designed to be called directly by end users. Get-AbrProcessInfo .NOTES - Version: 0.1.2 + Version: 0.1.3 Author: AsBuiltReport Community Twitter: @AsBuiltReport Github: AsBuiltReport @@ -152,7 +152,7 @@ function Get-AbrProcessInfo { try { $ProcessDiagram = Get-AbrProcessDiagram if ($ProcessDiagram) { - Export-AbrDiagram -DiagramObject $ProcessDiagram -MainDiagramLabel $reportTranslate.MainDiagramLabel -FileName 'AsBuiltReport.System.Resources.Cluster' + Export-AbrDiagram -DiagramObject $ProcessDiagram -MainDiagramLabel $reportTranslate.MainDiagramLabel -Filename 'AsBuiltReport.System.Resources.ProcessDiagram' } else { Write-PScriboMessage -IsWarning $reportTranslate.Unable } diff --git a/Src/Private/Get-AbrTimeZone.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrTimeZone.ps1 similarity index 100% rename from Src/Private/Get-AbrTimeZone.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrTimeZone.ps1 diff --git a/Src/Private/Get-AbrUptime.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 similarity index 100% rename from Src/Private/Get-AbrUptime.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 diff --git a/Src/Private/Get-SystemUptime.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-SystemUptime.ps1 similarity index 100% rename from Src/Private/Get-SystemUptime.ps1 rename to AsBuiltReport.System.Resources/Src/Private/Get-SystemUptime.ps1 diff --git a/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 b/AsBuiltReport.System.Resources/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 similarity index 100% rename from Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 rename to AsBuiltReport.System.Resources/Src/Public/Invoke-AsBuiltReport.System.Resources.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 785db01..5646617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update module dependencies to reflect the change - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core - Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements +- Bump AsBuiltReport.Diagram to version 1.0.2 to include latest diagramming features and improvements +- Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory +- Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance ## [0.1.2] - 2026-02-22 From 90cbe6fda200dcf47b2737227f783b91b24850b5 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Mon, 16 Mar 2026 14:29:09 -0400 Subject: [PATCH 05/13] Add links for AsBuiltReport.Diagram and AsBuiltReport.Chart modules in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3ab2a4c..a7135c0 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,8 @@ This report is compatible with the following PowerShell versions; PowerShell 5.1 or PowerShell 7, and the following PowerShell modules are required for generating a System Resources As Built Report. - [AsBuiltReport.System.Resources Module](https://www.powershellgallery.com/packages/AsBuiltReport.System.Resources/) +- [AsBuiltReport.Diagram Module](https://www.powershellgallery.com/packages/AsBuiltReport.Diagram/) +- [AsBuiltReport.Chart Module](https://www.powershellgallery.com/packages/AsBuiltReport.Chart/) > [!IMPORTANT] > This report requires AsBuiltReport.Core version 1.5.0 or later to be installed. [Multilingual-support](https://www.asbuiltreport.com/blog/2025/09/05/Multilingual-support/) From 22d5b8760422406b1b173952068120657191df03 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Mon, 16 Mar 2026 17:53:04 -0400 Subject: [PATCH 06/13] Update AsBuiltReport.Diagram module version to 1.0.3 --- .../AsBuiltReport.System.Resources.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 index a89d30f..5790fa3 100644 --- a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 +++ b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 @@ -63,7 +63,7 @@ }, @{ ModuleName = 'AsBuiltReport.Diagram'; - ModuleVersion = '1.0.2' + ModuleVersion = '1.0.3' } ) From fe67d2785d3367b8335a227bc91990f0631203d2 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Mon, 16 Mar 2026 17:53:36 -0400 Subject: [PATCH 07/13] Bump AsBuiltReport.Diagram to version 1.0.3 Updated version of AsBuiltReport.Diagram to 1.0.3 for latest features. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5646617..1fa871d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update module dependencies to reflect the change - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core - Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements -- Bump AsBuiltReport.Diagram to version 1.0.2 to include latest diagramming features and improvements +- Bump AsBuiltReport.Diagram to version 1.0.3 to include latest diagramming features and improvements - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance From 466325ed4fe7fd4b6d57ae21955fbdaa683cb8e1 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Wed, 18 Mar 2026 21:26:03 -0400 Subject: [PATCH 08/13] Update AsBuiltReport.Diagram module version to 1.0.4 --- .../AsBuiltReport.System.Resources.psd1 | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 index 5790fa3..c72c1d9 100644 --- a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 +++ b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 @@ -63,7 +63,7 @@ }, @{ ModuleName = 'AsBuiltReport.Diagram'; - ModuleVersion = '1.0.3' + ModuleVersion = '1.0.4' } ) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fa871d..a080dd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update module dependencies to reflect the change - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core - Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements -- Bump AsBuiltReport.Diagram to version 1.0.3 to include latest diagramming features and improvements +- Bump AsBuiltReport.Diagram to version 1.0.4 to include latest diagramming features and improvements - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance From 9126bae8667f7f4a1aea5b6197e07363b4035910 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Tue, 24 Mar 2026 20:29:00 -0400 Subject: [PATCH 09/13] Bump AsBuiltReport.Diagram to version 1.0.5 for latest diagramming features and improvements --- .../AsBuiltReport.System.Resources.psd1 | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 index c72c1d9..d3cd67e 100644 --- a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 +++ b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.psd1 @@ -63,7 +63,7 @@ }, @{ ModuleName = 'AsBuiltReport.Diagram'; - ModuleVersion = '1.0.4' + ModuleVersion = '1.0.5' } ) diff --git a/CHANGELOG.md b/CHANGELOG.md index a080dd3..5745104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update module dependencies to reflect the change - Refactor code to use AsBuiltReport.Diagram instead of Diagrammer.Core - Bump AsBuiltReport.Chart to version 0.3.0 to include latest charting features and improvements -- Bump AsBuiltReport.Diagram to version 1.0.4 to include latest diagramming features and improvements +- Bump AsBuiltReport.Diagram to version 1.0.5 to include latest diagramming features and improvements - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance From a2f0a9e9b51d1150711f674ff01db551a754c3ae Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Tue, 24 Mar 2026 21:51:05 -0400 Subject: [PATCH 10/13] Enhance diagram aspect ratio handling in Export-AbrDiagram function --- .../Src/Private/Export-AbrDiagram.ps1 | 3 ++- CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 b/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 index 59223a6..bb0613a 100644 --- a/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 +++ b/AsBuiltReport.System.Resources/Src/Private/Export-AbrDiagram.ps1 @@ -164,7 +164,8 @@ function Export-AbrDiagram { $Graph = $DiagramObject $Diagram = New-AbrDiagram @DiagramParams -InputObject $Graph if ($Diagram) { - $BestAspectRatio = Get-BestImageAspectRatio -GraphObj $Diagram -MaxWidth 600 + $BestAspectRatio = Get-BestImageAspectRatio -GraphObj $Diagram -MaxWidth 600 -MaxHeight 600 + PageBreak Section -Style Heading3 $MainDiagramLabel { Image -Base64 $Diagram -Text "$MainDiagramLabel Diagram" -Width $BestAspectRatio.Width -Height $BestAspectRatio.Height -Align Center } diff --git a/CHANGELOG.md b/CHANGELOG.md index 5745104..d93f541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump AsBuiltReport.Diagram to version 1.0.5 to include latest diagramming features and improvements - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance +- Enhance diagram aspect ratio handling in Export-AbrDiagram function ## [0.1.2] - 2026-02-22 From 7acc0e1e4a11b53b8440289a10fc507a90157c4e Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Fri, 3 Apr 2026 18:06:51 -0400 Subject: [PATCH 11/13] Add Copilot instructions for AsBuiltReport.System.Resources module --- .github/copilot-instructions.md | 167 ++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..3218156 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,167 @@ +# Copilot Instructions + +## Project Overview + +This is **AsBuiltReport.System.Resources**, a PowerShell module for the [AsBuiltReport](https://github.com/AsBuiltReport) framework. It generates "As-Built" documentation reports (HTML, Word, Text) describing system resources (date/time, timezone, uptime, PowerShell host info, and top CPU processes) from a local or remote machine. + +## Lint & Validation Commands + +```powershell +# Validate the module manifest +Test-ModuleManifest .\AsBuiltReport.System.Resources\AsBuiltReport.System.Resources.psd1 + +# Run PSScriptAnalyzer with project settings +Invoke-ScriptAnalyzer -Path .\AsBuiltReport.System.Resources\Src -Settings .\.github\workflows\PSScriptAnalyzerSettings.psd1 -Recurse + +# Run PSScriptAnalyzer on a single file +Invoke-ScriptAnalyzer -Path .\AsBuiltReport.System.Resources\Src\Private\Get-AbrDate.ps1 -Settings .\.github\workflows\PSScriptAnalyzerSettings.psd1 +``` + +No automated test suite exists. PSScriptAnalyzer linting is the CI quality gate, enforced via `.github/workflows/PSScriptAnalyzer.yml` on every push and PR. + +## Generating a Report (Manual Testing) + +```powershell +# Install prerequisites +Install-Module AsBuiltReport.Core, AsBuiltReport.Chart, AsBuiltReport.Diagram -Force + +# Generate a report against localhost +New-AsBuiltReport -Report System.Resources -Target localhost -Format Html -OutputFolderPath C:\Reports -Verbose + +# Generate a default config file +New-AsBuiltReportConfig -Report System.Resources -FolderPath C:\Config +``` + +## Architecture + +### Entry Point Flow + +``` +New-AsBuiltReport (AsBuiltReport.Core framework) + └─ Invoke-AsBuiltReport.System.Resources [Src/Public/] + └─ For each $Target: + ├─ Get-AbrDate + ├─ Get-AbrTimeZone + ├─ Get-AbrUptime + │ └─ Get-SystemUptime (WMI fallback for PS 5.1) + ├─ Get-AbrPSHost + └─ Get-AbrProcessInfo + ├─ Get-AbrProcessDiagram + └─ Export-AbrDiagram +``` + +### Module Loader + +`AsBuiltReport.System.Resources.psm1` auto-discovers and dot-sources all `.ps1` files under `Src/Public/` and `Src/Private/`, then exports **both** public and private functions. Private functions must be exported because the AsBuiltReport.Core framework invokes them within its document script block scope. + +### Framework-Injected Variables + +The AsBuiltReport.Core framework injects these variables into module scope before execution — do not redefine them: + +| Variable | Purpose | +|---|---| +| `$ReportConfig` | Parsed JSON configuration object | +| `$InfoLevel` | Per-section detail level (0=disabled, 1=summary, 2=detailed) | +| `$Options` | Feature flags (diagrams, themes, exports) | +| `$Target` | Array of system names to document | +| `$System` | Current target being iterated | +| `$reportTranslate` | Localization string hashtable | +| `$Report` | Report metadata (ShowTableCaptions, etc.) | + +### Report Section Pattern + +Every section in `Src/Private/` follows the same structure: + +1. **Narrow localization scope** — `$reportTranslate = $reportTranslate.GetAbr` +2. **Collect data** — use standard PowerShell cmdlets or WMI +3. **Check InfoLevel** — wrap output in `if ($InfoLevel.
-ge 1)` blocks +4. **Render with PScribo** — use `Section`, `Table`, `Paragraph`, `Image` etc. + +### PowerShell Edition Detection + +Use `$PSVersionTable.PSEdition` to branch between PS 5.1 (Desktop) and PS 7+ (Core): + +```powershell +if ($PSVersionTable.PSEdition -eq 'Core') { + # Use modern cmdlets (e.g., Get-Uptime) +} else { + # Use WMI / CIM (e.g., Get-SystemUptime helper) +} +``` + +## Key Conventions + +### Naming + +- **Private functions:** `Get-Abr` (e.g., `Get-AbrDate`, `Get-AbrProcessInfo`) +- **WMI/compatibility helpers:** `Get-System` (e.g., `Get-SystemUptime`) +- **Public entry point:** `Invoke-AsBuiltReport.System.Resources` +- One function per file; filename matches function name exactly. + +### Table Data Pattern + +Always build table rows as ordered hashtables promoted to `[PSCustomObject]`, using localized strings as keys: + +```powershell +$InObj = [Ordered]@{ + $($reportTranslate.Date) = $Date.ToString('yyyy-MM-dd') + $($reportTranslate.Hour) = $Date.ToString('HH:mm:ss') +} +$SystemDateInfo += [PSCustomObject]$InObj +``` + +### Table Rendering Pattern + +Always set explicit `ColumnWidths` and conditionally add a caption: + +```powershell +$TableParams = @{ + Name = "Table Name" + List = $true + ColumnWidths = 40, 60 +} +if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" +} +$data | Table @TableParams +``` + +### Localization + +- Each language lives in `Language//SystemResources.psd1` as a nested hashtable. +- Narrow to the relevant subtable at the top of each function: `$reportTranslate = $reportTranslate.GetAbr` +- When adding new string keys, add them to **all 26+ language files** under `Language/`. + +### Diagram Pipeline + +Diagrams use Graphviz via `AsBuiltReport.Diagram`. The pipeline is always: +1. `Get-AbrProcessDiagram` — builds the graph object +2. `Export-AbrDiagram` — calls `New-Diagrammer`, embeds base64 in report, and optionally writes to disk + +Diagram features are gated by `$Options.EnableDiagrams`. + +### PSScriptAnalyzer Exclusions + +The following rules are intentionally suppressed (see `.github/workflows/PSScriptAnalyzerSettings.psd1`): +- `PSUseToExportFieldsInManifest` +- `PSReviewUnusedParameter` +- `PSUseDeclaredVarsMoreThanAssignments` +- `PSAvoidGlobalVars` +- `PSUseSingularNouns` +- `PSAvoidUsingWriteHost` + +Do not add `[SuppressMessage]` attributes for these — the settings file handles them globally. + +### Code Style + +- Indentation: **4 spaces** (no tabs) +- Line length: **115 characters** max +- Opening brace on same line; closing brace on its own line +- PascalCase for all function and parameter names +- Use correct PowerShell cmdlet casing (`Get-ChildItem`, not `get-childitem`) + +## Branch & Release Strategy + +- Feature branches merge into **`dev`** (never directly into `master`) +- `master` is the release branch; a GitHub release publication triggers the CI pipeline to publish to PowerShell Gallery +- Follow [Keep a Changelog](https://keepachangelog.com/) format for `CHANGELOG.md` entries From 69deb215e0b229fd742522af962d14945d97cfe9 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Fri, 3 Apr 2026 18:07:33 -0400 Subject: [PATCH 12/13] Add health check feature and update language resources for uptime monitoring --- .../AsBuiltReport.System.Resources.json | 4 +++- .../Language/ar-SA/SystemResources.psd1 | 4 +++- .../Language/cs-CZ/SystemResources.psd1 | 4 +++- .../Language/da-DK/SystemResources.psd1 | 4 +++- .../Language/de-DE/SystemResources.psd1 | 3 +++ .../Language/el-GR/SystemResources.psd1 | 3 +++ .../Language/en-GB/SystemResources.psd1 | 3 +++ .../Language/en-US/SystemResources.psd1 | 4 +++- .../Language/es-ES/SystemResources.psd1 | 4 +++- .../Language/fi-FI/SystemResources.psd1 | 3 +++ .../Language/fr-FR/SystemResources.psd1 | 3 +++ .../Language/he-IL/SystemResources.psd1 | 3 +++ .../Language/hi-IN/SystemResources.psd1 | 3 +++ .../Language/hu-HU/SystemResources.psd1 | 3 +++ .../Language/it-IT/SystemResources.psd1 | 3 +++ .../Language/ja-JP/SystemResources.psd1 | 3 +++ .../Language/ko-KR/SystemResources.psd1 | 3 +++ .../Language/nb-NO/SystemResources.psd1 | 3 +++ .../Language/nl-NL/SystemResources.psd1 | 3 +++ .../Language/pl-PL/SystemResources.psd1 | 3 +++ .../Language/pt-PT/SystemResources.psd1 | 3 +++ .../Language/ru-RU/SystemResources.psd1 | 3 +++ .../Language/sv-SE/SystemResources.psd1 | 3 +++ .../Language/th-TH/SystemResources.psd1 | 3 +++ .../Language/tr-TR/SystemResources.psd1 | 3 +++ .../Language/vi-VN/SystemResources.psd1 | 3 +++ .../Language/zh-CN/SystemResources.psd1 | 3 +++ .../Language/zh-Hans/SystemResources.psd1 | 3 +++ .../Language/zh-Hant/SystemResources.psd1 | 3 +++ .../Src/Private/Get-AbrUptime.ps1 | 22 +++++++++++++++++++ CHANGELOG.md | 10 ++++++++- 31 files changed, 118 insertions(+), 7 deletions(-) diff --git a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json index f1a6c34..bbf9887 100644 --- a/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json +++ b/AsBuiltReport.System.Resources/AsBuiltReport.System.Resources.json @@ -33,5 +33,7 @@ "PSHost": 2, "ProcessInfo": 1 }, - "HealthCheck": {} + "HealthCheck": { + "Uptime": true + } } \ No newline at end of file diff --git a/AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 index 5f200d5..5c66949 100644 --- a/AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/ar-SA/SystemResources.psd1 @@ -64,8 +64,10 @@ ParagraphDetail = تفصل الأقسام التالية وقت تشغيل النظام. ParagraphSummary = يلخص الجدول التالي وقت تشغيل النظام. Heading = وقت التشغيل - Uptime = وقت التشغيل + HealthCheck = التحقق من الصحة + CorrectiveActions = الإجراءات التصحيحية: + Downtime = وقت تشغيل النظام أقل من 24 ساعة. راجع سجلات النظام لتحديد أي أحداث قد تكون تسببت في التوقف غير المتوقع. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 index c431369..4c39e33 100644 --- a/AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/cs-CZ/SystemResources.psd1 @@ -65,8 +65,10 @@ ParagraphDetail = Následující části podrobně popisují dobu provozu systému. ParagraphSummary = Následující tabulka shrnuje dobu provozu systému. Heading = Doba provozu - Uptime = Doba provozu + HealthCheck = Kontrola stavu + CorrectiveActions = Opatření k nápravě: + Downtime = Doba provozu systému je kratší než 24 hodin. Zkontrolujte systémové protokoly, abyste zjistili jakékoli události, které mohly způsobit neočekávané přerušení. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 index 773a2b9..98fb64e 100644 --- a/AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/da-DK/SystemResources.psd1 @@ -64,8 +64,10 @@ ParagraphDetail = Følgende afsnit beskriver systemets oppetid. ParagraphSummary = Følgende tabel opsummerer systemets oppetid. Heading = Oppetid - Uptime = Oppetid + HealthCheck = Sundhedstjek + CorrectiveActions = Korrigerende handlinger: + Downtime = Systemets oppetid er under 24 timer. Gennemgå systemlogfilerne for at identificere eventuelle hændelser, der kan have forårsaget den uventede nedetid. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 index 8240c83..6918573 100644 --- a/AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/de-DE/SystemResources.psd1 @@ -66,6 +66,9 @@ Heading = Betriebszeit Uptime = Betriebszeit + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 index aab5567..884c9ba 100644 --- a/AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/el-GR/SystemResources.psd1 @@ -66,6 +66,9 @@ Heading = Χρόνος λειτουργίας Uptime = Χρόνος λειτουργίας + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 index 6f2a47f..ae9e7b9 100644 --- a/AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/en-GB/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Uptime Uptime = Uptime + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 index e16fb01..76b9443 100644 --- a/AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/en-US/SystemResources.psd1 @@ -64,8 +64,10 @@ ParagraphDetail = The following sections detail the system Uptime. ParagraphSummary = The following table summarises the system Uptime. Heading = Uptime - Uptime = Uptime + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 index f989a83..b1f4f15 100644 --- a/AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/es-ES/SystemResources.psd1 @@ -64,8 +64,10 @@ ParagraphDetail = Las siguientes secciones detallan el tiempo de actividad del sistema. ParagraphSummary = La siguiente tabla resume el tiempo de actividad del sistema. Heading = Tiempo de Actividad - Uptime = Tiempo de Actividad + HealthCheck = Verificación de Salud + CorrectiveActions = Acciones Correctivas: + Downtime = El tiempo de actividad del sistema es inferior a 24 horas. Revise los registros del sistema para identificar cualquier evento que pueda haber causado el tiempo de inactividad inesperado. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 index d67063d..c761ed8 100644 --- a/AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/fi-FI/SystemResources.psd1 @@ -71,6 +71,9 @@ Heading = Käyttöaika Uptime = Käyttöaika + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 index f6f4d3b..b2a4e66 100644 --- a/AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/fr-FR/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Temps de fonctionnement Uptime = Temps de fonctionnement + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 index 307697e..1dd62bc 100644 --- a/AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/he-IL/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = זמן פעילות Uptime = זמן פעילות + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 index fd025a1..1b85c9c 100644 --- a/AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/hi-IN/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = अपटाइम Uptime = अपटाइम + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 index bf7f2bb..23b1a35 100644 --- a/AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/hu-HU/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Üzemidő Uptime = Üzemidő + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 index ed208d9..da67c42 100644 --- a/AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/it-IT/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Tempo di attività Uptime = Tempo di attività + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 index f1d0eb5..38fcd3c 100644 --- a/AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/ja-JP/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = 稼働時間 Uptime = 稼働時間 + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 index 766d1b9..6fa957a 100644 --- a/AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/ko-KR/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = 가동 시간 Uptime = 가동 시간 + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 index a2ff1fc..022990d 100644 --- a/AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/nb-NO/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Oppetid Uptime = Oppetid + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 index ecb0b6b..0ced812 100644 --- a/AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/nl-NL/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Bedrijfstijd Uptime = Bedrijfstijd + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 index ea37127..84eb750 100644 --- a/AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/pl-PL/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Czas pracy Uptime = Czas pracy + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 index f04f14f..b6f3c41 100644 --- a/AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/pt-PT/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Tempo de atividade Uptime = Tempo de atividade + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 index 485fd57..4651787 100644 --- a/AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/ru-RU/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Время работы Uptime = Время работы + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 index ec0b4a2..a8fcb96 100644 --- a/AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/sv-SE/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Drifttid Uptime = Drifttid + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 index bf50d27..b1d3f65 100644 --- a/AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/th-TH/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = เวลาทำงาน Uptime = เวลาทำงาน + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 index b8339b2..e2a79a8 100644 --- a/AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/tr-TR/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Çalışma Süresi Uptime = Çalışma Süresi + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 index 16e4451..91e3e6d 100644 --- a/AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/vi-VN/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = Thời gian hoạt động Uptime = Thời gian hoạt động + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 index 5ae89b7..4d94a7c 100644 --- a/AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/zh-CN/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = 运行时间 Uptime = 运行时间 + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 index f4d468b..3bea09a 100644 --- a/AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/zh-Hans/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = 正常运行时间 Uptime = 正常运行时间 + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 b/AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 index 66eb62b..2bbda5b 100644 --- a/AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 +++ b/AsBuiltReport.System.Resources/Language/zh-Hant/SystemResources.psd1 @@ -67,6 +67,9 @@ Heading = 執行時間 Uptime = 執行時間 + HealthCheck = Health Check + CorrectiveActions = Corrective Actions: + Downtime = System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime. '@ # Get-AbrPSHost diff --git a/AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 b/AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 index 9de55c8..58510af 100644 --- a/AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 +++ b/AsBuiltReport.System.Resources/Src/Private/Get-AbrUptime.ps1 @@ -82,6 +82,10 @@ function Get-AbrUptime { $SystemUptimeInfo += [PSCustomObject]$InObj } + if ($HealthCheck.Uptime) { + $SystemUptimeInfo | Where-Object { $_.$($reportTranslate.Uptime) -lt 24 } | Set-Style -Style Warning -Property $($reportTranslate.Uptime) + } + if ($InfoLevel.Uptime -ge 2) { # InfoLevel 2: render each target as its own subsection with a list-style table. Paragraph $reportTranslate.ParagraphDetail @@ -96,6 +100,15 @@ function Get-AbrUptime { $TableParams['Caption'] = "- $($TableParams.Name)" } $UptimeInfo | Table @TableParams + # If health check is enabled and any target has uptime less than 24 hours, show the warning and corrective actions. + if ($HealthCheck.Uptime -and ($UptimeInfo | Where-Object { $_.$($reportTranslate.Uptime) -lt 24 })) { + Paragraph $reportTranslate.HealthCheck -Bold -Underline + BlankLine + Paragraph { + Text $reportTranslate.CorrectiveActions -Bold + Text $reportTranslate.Downtime + } + } } } } else { @@ -112,6 +125,15 @@ function Get-AbrUptime { $TableParams['Caption'] = "- $($TableParams.Name)" } $SystemUptimeInfo | Table @TableParams + # If health check is enabled and any target has uptime less than 24 hours, show the warning and corrective actions. + if ($HealthCheck.Uptime -and ($SystemUptimeInfo | Where-Object { $_.$($reportTranslate.Uptime) -lt 24 })) { + Paragraph $reportTranslate.HealthCheck -Bold -Underline + BlankLine + Paragraph { + Text $reportTranslate.CorrectiveActions -Bold + Text $reportTranslate.Downtime + } + } } } } diff --git a/CHANGELOG.md b/CHANGELOG.md index d93f541..373876f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.1.3] - 2026-03-?? +## [0.1.3] - 2026-04-03 + +### Added + +- Add Copilot instructions for AsBuiltReport.System.Resources module +- Add health check feature: + - Add HealthCheck parameter to report config to enable/disable health check warnings + - Add Uptime health check that warns if uptime is less than 24 hours, with corrective action guidance ### Changed @@ -17,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Reorganize module structure - moved module files to AsBuiltReport.System.Resources/ subdirectory - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance - Enhance diagram aspect ratio handling in Export-AbrDiagram function +- Update language resources for uptime monitoring and health check sections ## [0.1.2] - 2026-02-22 From 8894a4836b49ebd8f6a22185541a10100693e2af Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Fri, 3 Apr 2026 18:12:27 -0400 Subject: [PATCH 13/13] Update Sample File --- CHANGELOG.md | 1 + Samples/System Resources As Built Report.html | 105 +++++++++--------- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 373876f..1613fcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update zentered/bluesky-post-action to v0.4.0 for improved stability and performance - Enhance diagram aspect ratio handling in Export-AbrDiagram function - Update language resources for uptime monitoring and health check sections +- Update Sample Files to reflect new features and changes ## [0.1.2] - 2026-02-22 diff --git a/Samples/System Resources As Built Report.html b/Samples/System Resources As Built Report.html index f9735a4..d2f0fad 100644 --- a/Samples/System Resources As Built Report.html +++ b/Samples/System Resources As Built Report.html @@ -8,41 +8,41 @@ hr { margin-top: 1.0rem; } .portrait { background: white; width: 210mm; display: block; margin-top: 1rem; margin-left: auto; margin-right: auto; margin-bottom: 1rem; position: relative; border-style: solid; border-width: 1px; border-color: #c6c6c6; } .landscape { background: white; width: 297mm; display: block; margin-top: 1rem; margin-left: auto; margin-right: auto; margin-bottom: 1rem; position: relative; border-style: solid; border-width: 1px; border-color: #c6c6c6; } - .Heading6 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #009683; } - .NOTOCHeading4 { font-family: 'Segoe Ui'; font-size: 1.00rem; text-align: left; font-weight: normal; color: #958026; } - .Heading3 { font-family: 'Segoe Ui'; font-size: 1.08rem; text-align: left; font-weight: normal; color: #395879; } .Footer { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: center; font-weight: normal; color: #565656; } - .Normal { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; } - .Caption { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; font-style: italic; color: #072e58; } - .Heading5 { font-family: 'Segoe Ui'; font-size: 0.92rem; text-align: left; font-weight: normal; color: #009684; } .Header { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: center; font-weight: normal; color: #565656; } - .Title3 { font-family: 'Segoe Ui'; font-size: 1.00rem; text-align: left; font-weight: normal; color: #395879; } - .NOTOCHeading7 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; font-style: italic; color: #00ebcd; } - .Heading2 { font-family: 'Segoe Ui'; font-size: 1.17rem; text-align: left; font-weight: normal; color: #204369; } - .Critical { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #feddd7; } - .Title2 { font-family: 'Segoe Ui'; font-size: 1.50rem; text-align: center; font-weight: normal; color: #204369; } - .NOTOCHeading6 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #009683; } + .Title { font-family: 'Segoe Ui'; font-size: 2.00rem; text-align: center; font-weight: normal; color: #072e58; } .Heading1 { font-family: 'Segoe Ui'; font-size: 1.33rem; text-align: left; font-weight: normal; color: #072e58; } .Heading4 { font-family: 'Segoe Ui'; font-size: 1.00rem; text-align: left; font-weight: normal; color: #958026; } - .TableDefaultHeading { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #fafafa; background-color: #072e58; } + .Heading3 { font-family: 'Segoe Ui'; font-size: 1.08rem; text-align: left; font-weight: normal; color: #395879; } + .NOTOCHeading6 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #009683; } .Warning { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #fff4c7; } + .Heading6 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #009683; } + .Heading2 { font-family: 'Segoe Ui'; font-size: 1.17rem; text-align: left; font-weight: normal; color: #204369; } + .Caption { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; font-style: italic; color: #072e58; } + .NOTOCHeading7 { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; font-style: italic; color: #00ebcd; } .TableDefaultRow { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; } - .NOTOCHeading5 { font-family: 'Segoe Ui'; font-size: 0.92rem; text-align: left; font-weight: normal; color: #009684; } - .Title { font-family: 'Segoe Ui'; font-size: 2.00rem; text-align: center; font-weight: normal; color: #072e58; } - .OK { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #dff0d0; } + .TableDefaultHeading { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #fafafa; background-color: #072e58; } + .Critical { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #feddd7; } + .Normal { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; } + .Title3 { font-family: 'Segoe Ui'; font-size: 1.00rem; text-align: left; font-weight: normal; color: #395879; } + .Title2 { font-family: 'Segoe Ui'; font-size: 1.50rem; text-align: center; font-weight: normal; color: #204369; } + .Info { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #e3f5fc; } .TOC { font-family: 'Segoe Ui'; font-size: 1.33rem; text-align: left; font-weight: normal; color: #072e58; } + .NOTOCHeading4 { font-family: 'Segoe Ui'; font-size: 1.00rem; text-align: left; font-weight: normal; color: #958026; } + .Heading5 { font-family: 'Segoe Ui'; font-size: 0.92rem; text-align: left; font-weight: normal; color: #009684; } .TableDefaultAltRow { font-family: 'Calibri','Candara','Segoe','Segoe UI','Optima','Arial','Sans-Serif'; font-size: 0.92rem; text-align: left; font-weight: normal; color: #000000; background-color: #d0ddee; } - .Info { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #e3f5fc; } - table.borderless { padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } - table.borderless th { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } - table.borderless td { padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } - table.borderless tr:nth-child(odd) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } - table.borderless tr:nth-child(even) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } + .OK { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; background-color: #dff0d0; } + .NOTOCHeading5 { font-family: 'Segoe Ui'; font-size: 0.92rem; text-align: left; font-weight: normal; color: #009684; } table.tabledefault { padding: 0.08rem 0.17rem 0.13rem 0.17rem; border-style: solid; border-width: 0.02rem; border-color: #072e58; border-collapse: collapse; } table.tabledefault th { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #fafafa; background-color: #072e58; padding: 0.08rem 0.17rem 0.13rem 0.17rem; border-style: solid; border-width: 0.02rem; border-color: #072e58; border-collapse: collapse; } table.tabledefault td { padding: 0.08rem 0.17rem 0.13rem 0.17rem; border-style: solid; border-width: 0.02rem; border-color: #072e58; border-collapse: collapse; } table.tabledefault tr:nth-child(odd) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.17rem 0.13rem 0.17rem; border-style: solid; border-width: 0.02rem; border-color: #072e58; border-collapse: collapse; } table.tabledefault tr:nth-child(even) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.17rem 0.13rem 0.17rem; border-style: solid; border-width: 0.02rem; border-color: #072e58; border-collapse: collapse; } + table.borderless { padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } + table.borderless th { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } + table.borderless td { padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } + table.borderless tr:nth-child(odd) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; } + table.borderless tr:nth-child(even) { font-family: 'Segoe Ui'; font-size: 0.83rem; text-align: left; font-weight: normal; color: #565656; padding: 0.08rem 0.33rem 0rem 0.33rem; border-style: none; border-collapse: collapse; }
@@ -51,43 +51,43 @@

System Resources As Built Report

As Built Report






















- +
Author:As Built Report
Date:Sunday, February 22, 2026
Date:Friday, April 3, 2026
Version:1.0

System Resources As Built Report - v1.0

Table of Contents

- - - - - - - - - + + + + + + + + +
1LOCALHOST
1.1   Date
1.2   TimeZone
1.3   Uptime
1.4   PowerShell Host
1.5   Process
1.5.1      CPU Usage - Chart
1.5.2      Memory Usage - Chart
1.5.3      Process Hierarchy Diagram
1LOCALHOST
1.1   Date
1.2   TimeZone
1.3   Uptime
1.4   PowerShell Host
1.5   Process
1.5.1      CPU Usage - Chart
1.5.2      Memory Usage - Chart
1.5.3      Process Hierarchy Diagram

-
System Resources As Built Report - v1.0

1 LOCALHOST

1.1 Date

The following table summarises the system date.

+
System Resources As Built Report - v1.0

1 LOCALHOST

1.1 Date

The following table summarises the system date.

- +
DateHour
2026-02-2215:53:07
2026-04-0318:09:29
Table 1 - Date - localhost

-

1.2 TimeZone

The following sections detail the system TimeZone.

localhost

+

1.2 TimeZone

The following sections detail the system TimeZone.

localhost

- +
TimeZoneAmerica/Puerto_Rico
DisplayName(UTC-04:00) Atlantic Time (Puerto Rico)
Current Time02/22/2026 15:53:07
Current Time04/03/2026 18:09:29
Base UTC Offset-04:00:00
Supports Daylight Saving TimeYes
Table 2 - TimeZone - localhost

-

1.3 Uptime

The following sections detail the system Uptime.

localhost

+

1.3 Uptime

The following sections detail the system Uptime.

localhost

- +
Uptime04h 43m 00s
Uptime08h 16m 21s
Table 3 - Uptime - localhost

-

1.4 PowerShell Host

The following sections detail the system PowerShell Host.

localhost

+
Health Check

Corrective Actions: System Uptime is below 24 hours. Review the system logs to identify any events that may have caused the unexpected downtime.

1.4 PowerShell Host

The following sections detail the system PowerShell Host.

localhost

@@ -96,23 +96,24 @@
NameVisual Studio Code Host
Version2025.4.0
Debugger EnabledUnknown
Table 4 - PowerShell Host - localhost

-

1.5 Process

The following table summarises the top 5 system process. For more detailed information, please set the InfoLevel.ProcessInfo value to 2 in your report configuration file. Sorted by CPU usage.

+

1.5 Process

The following table summarises the top 5 system process. For more detailed information, please set the InfoLevel.ProcessInfo value to 2 in your report configuration file. Sorted by CPU usage.

- - - - - + + + + +
NameIdCPU (%)Memory (MB)
cosmic-comp829535237
code20994510355
chrome11544403216
chrome1829360392
chrome16726220173
remmina11689938154
chrome7441595126
cosmic-comp876584257
code24963547389
chrome7366452238
Table 5 - Process - localhost

-

1.5.1 CPU Usage - Chart

+
System Resources As Built Report - v1.0

1.5.3 Process Hierarchy Diagram

+Process Hierarchy Diagram Diagram
-

\ No newline at end of file +

\ No newline at end of file