Skip to content

Install-DbaMaintenanceSolution: Test for supported version#10398

Merged
potatoqualitee merged 1 commit into
developmentfrom
fix_Install-DbaMaintenanceSolution
Jun 27, 2026
Merged

Install-DbaMaintenanceSolution: Test for supported version#10398
potatoqualitee merged 1 commit into
developmentfrom
fix_Install-DbaMaintenanceSolution

Conversation

@andreasjordan

Copy link
Copy Markdown
Collaborator

Type of Change

  • Bug fix (non-breaking change, fixes Install-DbaMaintenanceSolution Does not check on SQL version #10392 )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

See issue for details.

@andreasjordan

Copy link
Copy Markdown
Collaborator Author

@claude please review this pull request.

@claude

claude Bot commented Jun 26, 2026

Copy link
Copy Markdown

Claude finished @andreasjordan's task in 1m 20s —— View job


PR Review: Install-DbaMaintenanceSolution — Test for Supported Version

  • Gather PR diff and context
  • Read the changed file
  • Analyze the fix against the referenced issue
  • Provide review feedback

Summary

This PR adds a SQL Server version guard to Install-DbaMaintenanceSolution, preventing installation attempts on SQL Server 2016 and earlier (which are no longer supported by the current Ola Hallengren Maintenance Solution). It's a clean, minimal, well-targeted fix.


Changes Reviewed

Two distinct additions:

1. .DESCRIPTION update (lines 9–11) — adds a compatibility note with a link to older versions:

The Maintenance Solution is compatible with SQL Server 2017 and later.
For earlier versions, please use the version of Ola Hallengren's scripts that corresponds to your SQL Server version.
You can find the appropriate version of the scripts at https://ola.hallengren.com/downloads.html.

2. Version check in the process block (lines 465–467):

if ($server.Version.Major -lt 14) {
    Stop-Function -Message "The Maintenance Solution is not supported on SQL Server version $($server.Version). Skipping $instance." -Target $instance -Continue
}

Code Quality

Check Status
Version number correct (SQL 2017 = major 14)
Uses -Continue to skip unsupported instances gracefully (not halt pipeline)
Check placed after Connect-DbaInstance (requires connection to get version) but before all expensive work
Double quotes used throughout
No = $true in parameters, no backticks, no ::new()
Description matches the code constraint

Minor Observations

  1. Error message shows raw version number: $server.Version outputs something like 14.0.1000.169, not SQL Server 2017. This is useful for diagnostics but may be slightly confusing for users who don't map version numbers to release names. A friendlier alternative could be:

    Stop-Function -Message "The Maintenance Solution requires SQL Server 2017 (v14) or later. Current version: $($server.Version). Skipping $instance." -Target $instance -Continue

    This is a minor polish point, not a blocker.

  2. No Pester test included: The PR checklist does not include a new test. Testing this specific guard requires a SQL Server 2016 or older instance in CI, which may not be available. Given the simplicity of the check and the infrastructure constraint, skipping a test here is reasonable. A unit test mocking $server.Version could theoretically cover it, but isn't strictly necessary.

  3. The description URL (https://ola.hallengren.com/downloads.html) is the correct official download page — good addition to help users on older SQL Server versions find the right script.


Verdict

This PR is correct and ready to merge. The fix is minimal, accurate, and follows the project's conventions. The version boundary (major < 14) correctly targets SQL Server 2016 and below. The graceful -Continue behavior means multi-instance pipelines won't abort on one unsupported server.

The minor message wording suggestion above is optional — the current message is still clear and functional.

@potatoqualitee
potatoqualitee merged commit 5c6a454 into development Jun 27, 2026
15 checks passed
@potatoqualitee
potatoqualitee deleted the fix_Install-DbaMaintenanceSolution branch June 27, 2026 08:38
@potatoqualitee

Copy link
Copy Markdown
Member

beautiful review, thank you both 🙏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install-DbaMaintenanceSolution Does not check on SQL version

2 participants