dsccommunity / dsccommunity/SqlServerDsc

SqlAlwaysOnService: Loading wrong SQLPS when both SQL Server 2014 and SQL Server 2016 exists

Open
#806 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
PowerShell
Stars
385
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring:
Enable AlwaysOn fails to configure SQL Server 2016 when both SQL Server 2014 and SQL Server 2016 is installed and having SQLPS module installed for both major version.
The reason is that sometimes the wrong SQLPS module is loaded (because it is the first in the $env:PATH list).

Could not obtain information about SQL Server Service 'MSSQL$DSCSQL2016'.
    + CategoryInfo          : ResourceUnavailable: (MSSQL$DSCSQL2016:) [], CimException
    + FullyQualifiedErrorId : ServiceError,Microsoft.SqlServer.Management.PowerShell.Hadr.EnableSqlHADRServiceCommand
    + PSComputerName        : localhost

The DSC configuration that is using the resource (as detailed as possible):

xSQLServerAlwaysOnService 'Integration_Test'
{
     Ensure               = 'Present'
     SQLServer            = $Node.ComputerName
     SQLInstanceName      = $Node.InstanceName
     RestartTimeout       = $Node.RestartTimeout
     PsDscRunAsCredential = $SqlInstallCredential
}

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Windows Server 2016, SQL Server 2014 and 2016, WMF 5.1

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
SQLPS

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing xSQLServerAlwaysOnService with SQL Server 2014 and 2016, both exposing SQLPS, and inspect how the resource resolves the SQLPS module from the environment. Confirm completion by showing that Enable AlwaysOn targets the SQL Server 2016 instance and no longer raises the reported service information error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, sql
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.