SSMS Uninstall removed PowerShell SQLPS module

Stefan Hoffmann 621 Reputation points
2020-10-21T15:43:37.16+00:00

I've uninstalled SSMS 16.3 before installing the actual 18 version.

Sadly the SSMS uninstall removed more than SSMS, for example SQLNCLI, CLR types and PowerShell modules like SqlServer and SQLPS. And the 18 install did not reinstall them.

Problem the system job syspolicy_purge_history uses SQLPS.

How to I get SQLPS back?
Is this a known flaw?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,240 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Leon Laude 85,566 Reputation points
    2020-10-21T15:45:41.743+00:00

    Hi @Stefan Hoffmann ,

    With SSMS 16.x, an earlier version of the SqlServer module is included with SQL Server Management Studio (SSMS), so yes it's probably by design.

    You can download the SQL PowerShell module from here:
    https://www.powershellgallery.com/packages/Sqlserver/21.1.18229

    For more information see:

    Install the SQL Server PowerShell module
    https://learn.microsoft.com/en-us/sql/powershell/download-sql-server-ps-module?view=sql-server-ver15

    ----------

    (If the reply was helpful please don't forget to upvote or accept as answer, thank you)

    Best regards,
    Leon

    0 comments No comments

  2. Ben Miller (DBAduck) 951 Reputation points
    2020-10-22T03:40:35.903+00:00

    SQLPS was probably never uninstalled, because it is used by the SQL Server Agent, but it may have removed the path to it as you uninstalled 16 SSMS.

    You can look under a folder similar to this for SQLPS folder
    C:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules

    Launch PowerShell and type

    $env:PSModulePath -split ";"
    

    Then see if you see any type of path above. You should see one with the 140 if you have 2017 SQL and 130 if you have 2016 and 120 if it is 2014, etc. It gets installed with the engine, so if this server does not have SQL installed on it, then you will want to use the SqlServer module as indicated above as SQLPS is not a good one to use as a client.

    Let me know if you need more information.

    0 comments No comments

  3. CathyJi-MSFT 21,106 Reputation points Microsoft Vendor
    2020-10-22T03:49:46.013+00:00

    Hi @Stefan Hoffmann ,

    The note from SSMS download document.

    The SQL Server PowerShell module is a separate install through the PowerShell Gallery. For more information, see Download SQL Server PowerShell Module.

    Install SQL Server PowerShell module, refer to the detail step from the blog SSMS VERSION 17.4 NO MORE SQLPS MODULE.

    Best regards,
    Cathy


    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments