Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/PSScriptAnalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: Run PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: lint
uses: alagoutte/github-action-psscriptanalyzer@master
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Pester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up PowerShell Gallery
run: |
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.os }}-${{ matrix.shell }}
path: Tests/testResults.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
publish-to-gallery:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set PSRepository to Trusted for PowerShell Gallery
shell: pwsh
run: |
Expand Down
3 changes: 2 additions & 1 deletion AsBuiltReport.Microsoft.AD/AsBuiltReport.Microsoft.AD.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"SignatureAuthorName": "",
"SignatureCompanyName": "",
"JobsTimeOut": 900,
"DCStatusPingCount": 2
"DCStatusPingCount": 2,
"DisableDiagramMainLogo": false
},
"InfoLevel": {
"_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ function Get-AbrDiagrammer {
$DiagramParams.Add('CompanyName', $Options.SignatureCompanyName)
}

if ($Options.DisableDiagramMainLogo) {
$DiagramParams.Add('DisableMainDiagramLogo', $True)
}

try {
foreach ($Format in $DiagramFormat) {
if ($Format -eq 'base64') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function New-AbrADDiagram {
Control to enable subgraph debugging ( Subgraph Lines ).
.PARAMETER EnableErrorDebug
Control to enable error debugging.
.PARAMETER DisableMainDiagramLogo
Switch to disable rendering the main diagram logo.
.PARAMETER AuthorName
Allow to set footer signature Author Name.
.PARAMETER CompanyName
Expand Down Expand Up @@ -155,6 +157,12 @@ function New-AbrADDiagram {
[ValidateSet('left-to-right', 'top-to-bottom')]
[string] $Direction = 'top-to-bottom',

[Parameter(
Mandatory = $false,
HelpMessage = 'Disable the Main Diagram Logo'
)]
[Switch] $DisableMainDiagramLogo,

[Parameter(
Mandatory = $false,
HelpMessage = 'Please provide the path to the diagram output file'
Expand Down Expand Up @@ -510,8 +518,15 @@ function New-AbrADDiagram {

Write-Verbose $reportTranslate.NewADDiagram.genDiagramSignature

# Subgraph MainGraph used to draw the main drawboard.
if ($DisableMainDiagramLogo) {
$FormatedMainLogo = ''
} else {
$FormatedMainLogo = Add-HtmlLabel -ImagesObj $Images -Label $MainGraphLabel -IconType $CustomLogo -IconDebug $IconDebug -IconWidth 250 -IconHeight 80 -Fontsize 24 -FontName 'Segoe UI Bold' -FontColor $Fontcolor -TableBackgroundColor $MainGraphBGColor -CellBackgroundColor $MainGraphBGColor
}

# Main Graph SubGraph
SubGraph MainGraph -Attributes @{Label = (Add-HtmlLabel -ImagesObj $Images -Label $MainGraphLabel -IconType $CustomLogo -IconDebug $IconDebug -IconWidth 250 -IconHeight 80 -Fontsize 24 -FontName 'Segoe UI Bold' -FontColor $Fontcolor -TableBackgroundColor $MainGraphBGColor -CellBackgroundColor $MainGraphBGColor); fontsize = 22; penwidth = 0; labelloc = 't'; labeljust = 'c' } {
SubGraph MainGraph -Attributes @{Label = $FormatedMainLogo; fontsize = 22; penwidth = 0; labelloc = 't'; labeljust = 'c' } {
Write-Verbose $reportTranslate.NewADDiagram.genDiagramMain

$script:ForestRoot = $ADSystem.Name.ToString().ToUpper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ function ConvertTo-HashToYN {
.SYNOPSIS
Used by As Built Report to convert array content true or false automatically to Yes or No.
.DESCRIPTION

Used by As Built Report to convert array content true or false automatically to Yes or No.
Now also strips non-printable ASCII characters from string values while creating the array hash.
This is required for Word Document Output as PSCribo cannot create Word documents with non-ASCII characters
.NOTES
Version: 0.2.0
Version: 0.1.1
Author: Jonathan Colon
Changes: 0.1.1 - Updated to include non-unicode character string cleaning. Graham Flynn - 30/07/2025

.EXAMPLE

Expand All @@ -22,14 +25,31 @@ function ConvertTo-HashToYN {
)

$result = [ordered] @{}

foreach ($i in $TEXT.GetEnumerator()) {
try {
$result.add($i.Key, (ConvertTo-TextYN $i.Value))
$valueToProcess = $i.Value

# Check if the value is a string before attempting to clean it
if ($valueToProcess -is [string]) {
$valueToProcess = $valueToProcess | Remove-NonPrintableAscii
}

$convertedValue = ConvertTo-TextYN $valueToProcess

$result.add($i.Key, $convertedValue)
} catch {
$result.add($i.Key, ($i.Value))
# If ConvertTo-TextYN fails, still try to clean the original value if it's a string
$originalValue = $i.Value
if ($originalValue -is [string]) {
$originalValue = $originalValue | Remove-NonPrintableAscii
}
$result.add($i.Key, ($originalValue)) # Add the (potentially cleaned) original value
}
}
if ($result) {
$result
} else { $TEXT }
return $result
} else {
return $TEXT
}
} # end
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function ConvertTo-TextYN {
Position = 0,
Mandatory)]
[AllowEmptyString()]
[AllowNull()]
[string] $TEXT
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function Remove-NonPrintableAscii {
<#
.SYNOPSIS
Removes non-printable ASCII characters from a string.
.DESCRIPTION
This function takes a string as input and returns a new string
where all characters outside the printable ASCII range (ASCII 32-126)
have been removed. If the input is null or empty, it returns an empty string.
.PARAMETER InputString
The string from which to remove non-printable ASCII characters.
.EXAMPLE
Remove-NonPrintableAscii -InputString "Hello`nWorld`t!"
# Output: "HelloWorld!"

.EXAMPLE
"This string has a null character: `0" | Remove-NonPrintableAscii
# Output: "This string has a null character: "

.EXAMPLE
$null | Remove-NonPrintableAscii
# Output: "" (empty string)

.EXAMPLE
"" | Remove-NonPrintableAscii
# Output: "" (empty string)
#>
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([String])]

param (
[Parameter(ValueFromPipeline = $true)]
[string]$InputString
)

process {
if ($PSCmdlet.ShouldProcess($InputString, 'Remove non-printable ASCII characters')) {
# Check if the input string is null or empty.
# If it is, return an empty string immediately to avoid errors.
if ([string]::IsNullOrEmpty($InputString)) {
return ''
}

# Regular expression to match any character that is NOT a printable ASCII character.
# [^\x20-\x7E] matches any character that is not in the range of ASCII 32 (space) to 126 (tilde).
$cleanedString = $InputString -replace '[^\x20-\x7E]', ''
return $cleanedString
}
}
}
2 changes: 1 addition & 1 deletion AsBuiltReport.Microsoft.AD/Src/Public/Get-AbrAdLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Get-AbrAdLog {
Saves a full diagnostic JSON (with stack traces) to C:\Logs and returns the
object to the pipeline.
.NOTES
Version: 0.1.0
Version: 1.0.1
Author: Jonathan Colon
Github: rebelinux
.LINK
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

##### This project is community maintained and has no sponsorship from Microsoft, its employees or any of its affiliates.

## [1.0.1] - unreleased
## [1.0.1] - 2026-06-22

### Added

Expand All @@ -18,13 +18,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump module version to `1.0.1`
- Upgrade AsBuiltReport.Diagram module to version `1.0.8`
- Upgrade AsBuiltReport.Chart module to version `0.3.3`
- Set an option to enable/disable the main logo of the diagrams
- Update github actions to latest releases

### Fixed

- Add validation for ADSystem before accessing RootDomain to prevent errors
- Add success message logging for completed commands in `Invoke-CommandWithTimeout` function
- Update localization files to include NoData messages and improve key matching in tests
- Fix [255](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.AD/issues/255)
- Fix: remove non-printable ASCII characters from a string

## [1.0.0] - 2026-05-02

Expand Down
Loading