From f0e3459261f5512bbb9603be034959d94c950e51 Mon Sep 17 00:00:00 2001 From: Nicolas Fabert <195452170+Nico77600@users.noreply.github.com> Date: Mon, 12 Oct 2026 13:59:49 +0100 Subject: [PATCH] Align runtime disclaimer with project README --- package/Invoke-ExchangeMailboxMigration.ps1 | 9 ++++++ package/README.md | 9 ++++++ tests/ExchangeMailboxMigration.Tests.ps1 | 36 +++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/package/Invoke-ExchangeMailboxMigration.ps1 b/package/Invoke-ExchangeMailboxMigration.ps1 index efe003f..8ea56cc 100644 --- a/package/Invoke-ExchangeMailboxMigration.ps1 +++ b/package/Invoke-ExchangeMailboxMigration.ps1 @@ -1,4 +1,5 @@ #Requires -Version 5.1 + <# .SYNOPSIS Exchange Mailbox Migration - moves Exchange Server mailboxes from source databases to target @@ -114,6 +115,14 @@ (batches kept on purpose are listed but do not change the code), 3 = cancelled at the confirmation question (nothing changed). Documentation : docs\ExchangeMailboxMigration-Guide.md (or .html) + + Disclaimer: + This Script is a Personal project. + It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft. + + As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production. + + Mailbox moves change production data: run the inventory, review the plan, simulate with `-WhatIf` and test in a lab before production use. #> [CmdletBinding(SupportsShouldProcess)] param( diff --git a/package/README.md b/package/README.md index b4c4b40..430ff5d 100644 --- a/package/README.md +++ b/package/README.md @@ -51,3 +51,12 @@ notepad .\config\ExchangeMailboxMigration.config.psd1 # Databases: source a Project page, releases and change log: https://github.com/Nico77600/ExchangeMailboxMigration License: [MIT](LICENSE). + +## Disclaimer + +This Script is a Personal project. +It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft. + +As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production. + +Mailbox moves change production data: run the inventory, review the plan, simulate with `-WhatIf` and test in a lab before production use. diff --git a/tests/ExchangeMailboxMigration.Tests.ps1 b/tests/ExchangeMailboxMigration.Tests.ps1 index b858a06..266dcc8 100644 --- a/tests/ExchangeMailboxMigration.Tests.ps1 +++ b/tests/ExchangeMailboxMigration.Tests.ps1 @@ -56,6 +56,42 @@ AfterAll { if ($script:Temp -and (Test-Path -LiteralPath $script:Temp)) { Remove-Item -LiteralPath $script:Temp -Recurse -Force } } +Describe 'Runtime disclaimer' { + BeforeAll { + $script:DisclaimerRepo = Split-Path $PSScriptRoot -Parent + $script:DisclaimerConfig = Get-Content (Join-Path $script:DisclaimerRepo '.github\ci.json') -Raw | ConvertFrom-Json + $script:DisclaimerRuntime = Join-Path $script:DisclaimerRepo $script:DisclaimerConfig.runtimeRoot + $script:DisclaimerPattern = '(?ms)^## Disclaimer[ \t]*\r?\n(?.*?)(?=^##[ \t]|\z)' + $rootReadme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRepo 'README.md')) + $matches = [regex]::Matches($rootReadme, $script:DisclaimerPattern) + if ($matches.Count -ne 1) { throw 'The root README must contain exactly one canonical disclaimer.' } + $script:CanonicalDisclaimer = $matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n") + function ConvertTo-DisclaimerParagraphs([string]$Text) { + (($Text.Trim() -split '\r?\n[ \t]*\r?\n') | ForEach-Object { ($_ -replace '\s+', ' ').Trim() }) -join "`n`n" + } + } + + It 'keeps the runtime README disclaimer identical to the canonical root section' { + $readme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRuntime 'README.md')) + $matches = [regex]::Matches($readme, $script:DisclaimerPattern) + $matches.Count | Should -Be 1 + $matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n") | Should -BeExactly $script:CanonicalDisclaimer + } + + It 'keeps the public entry script disclaimer attached to its help with the same wording and paragraphs' { + $path = Join-Path $script:DisclaimerRuntime $script:DisclaimerConfig.packageEntry + $errors = $null + $ast = [Management.Automation.Language.Parser]::ParseFile($path, [ref]$null, [ref]$errors) + @($errors).Count | Should -Be 0 + $help = $ast.GetHelpContent() + $help | Should -Not -BeNullOrEmpty + $notes = $help.Notes + [regex]::Matches($notes, '(?m)^[ \t]*Disclaimer:[ \t]*$').Count | Should -Be 1 + $body = [regex]::Match($notes, '(?s)(?:^|\r?\n)[ \t]*Disclaimer:[ \t]*\r?\n(?.*)\z').Groups['Body'].Value + (ConvertTo-DisclaimerParagraphs $body) | Should -BeExactly (ConvertTo-DisclaimerParagraphs $script:CanonicalDisclaimer) + } +} + Describe 'Configuration' { It 'accepts the delivered configuration file' { $s = Import-EmmConfiguration -Path (Join-Path $script:Root 'config\ExchangeMailboxMigration.config.psd1') -Root $script:Root