Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: Check for SQLPS & SQLServer modules required #91

Closed
kilasuit opened this issue Jul 31, 2016 · 5 comments · Fixed by #508
Closed

BREAKING CHANGE: Check for SQLPS & SQLServer modules required #91

kilasuit opened this issue Jul 31, 2016 · 5 comments · Fixed by #508
Labels
enhancement The issue is an enhancement request.

Comments

@kilasuit
Copy link

With the latest updates to SSMS the SQLPS module was renamed to SQLServer so with this in mind we should have a check in all the resources for the change of module name for this along the lines of

If (Get-Module SQLPS -ListAvailable) 
    {
        Write-Verbose "SQLPS Module Found"
        $module = Get-Module SQLPS -ListAvailable
    } 
    else 
    {
    Write-Verbose "SQLPS Module Not found - Using updated SQLServer module "
    $module = Get-Module SQLServer -ListAvailable
    }

Import-Module $module -WarningAction SilentlyContinue -ErrorAction Stop

Though this would need to be actioned in the same way across all of the resources where

Import-Module -Name SQLPS -WarningAction SilentlyContinue -ErrorAction Stop

is currently in place

@johlju
Copy link
Member

johlju commented Aug 1, 2016

If I look at a server with SQL Server 2016 installed without SSMS there is only SQLPS module.
If you install latest SSMS (July) on a server with SQL Server 2016 you get both SQLPS and SQLServer modules.

So I think if we want to use SQLServer before SQLPS, then the check should be switched. Like below. Or am I missing something?

If (Get-Module SQLServer -ListAvailable) 
{
    Write-Verbose "Preferred SQLServer module found"
    $module = Get-Module SQLServer -ListAvailable
} 
else 
{
    Write-Verbose "SQLServer module not found, using older SQLPS module "
    $module = Get-Module SQLPS -ListAvailable
}

@kilasuit
Copy link
Author

kilasuit commented Aug 1, 2016

Indeed - I wrote it very quickly last night to make sure that it was recorded as an issue to be aware of

Even moreso if the SQLServer Module gets published to the PowerShell Gallery as it wont require SSMS to be installed on that machine as well.

@johlju
Copy link
Member

johlju commented Aug 1, 2016

If it gets published to the gallery (and updated more frequently than SQL Server/SSMS) then it would be nice to have the option in the setup resource to pull that from the galley and install it.

@kwirkykat kwirkykat added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Aug 2, 2016
@johlju
Copy link
Member

johlju commented Aug 12, 2016

I think this issue also needs to make sure that tests are run using both SQLPS and SQLServer stub module. If SQLServer module will be the preferred module if it exists. Then all tests needs to be verified to be able to work with both modules.

@johlju
Copy link
Member

johlju commented Apr 17, 2017

We also need to add a control question for this in the GitHub ISSUE_TEMPLATE - if the user is using SQLPS och SQLServer module, and what version om the module.

@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Apr 17, 2017
@johlju johlju self-assigned this Apr 17, 2017
johlju added a commit to johlju/SqlServerDsc that referenced this issue Apr 17, 2017
Changed helper function Import-SQLPSModule to support SqlServer module (issue dsccommunity#91). The SqlServer module is the preferred module so if it is found it will be used, and if not found an attempt will be done to load SQLPS module instead.
Added new control question to ISSUE_TEMPLATE to know which module the user is using when submitting an issue.
@johlju johlju changed the title Check for SQLPS & SQLServer modules required BREAKING CHANGE: Check for SQLPS & SQLServer modules required Apr 19, 2017
johlju added a commit that referenced this issue Apr 19, 2017
- Changes to xSQLServerHelper module
  - BREAKING CHANGE: Changed helper function Import-SQLPSModule to support SqlServer module (issue #91). The SqlServer module is the preferred module so if it is found it will be used, and if not found an attempt will be done to load SQLPS module instead.
- Changes to xSQLServerScript
  - Updated tests for this resource, because they failed when Import-SQLPSModule was updated.
- Changes to ISSUE_TEMPLATE
  - Added new control question to ISSUE_TEMPLATE to know which module the user is using when submitting an issue.
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Apr 19, 2017
@johlju johlju removed their assignment Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants