Unable to import /Install SQLServer Module RRS feed

  • Question

  • Hi,

    I am getting this error while installing the SQL server Module

     PS C:\Windows\system32> Install-Module -Name SqlServer
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'SqlServer'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\\PSModule.psm1:1772 char:21
    + ...          $null = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
        + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
    PS C:\Windows\system32> 
    WARNING: Unable to find module repositories.

    Any help would be appreciated.


    • Moved by Bill_Stewart Wednesday, December 12, 2018 9:30 PM This is not SQL Server support forum
    Tuesday, August 28, 2018 8:31 PM

All replies

  • You have not configures your PoweShelGet repository.

    help Register-PSRepository -online

    If you are running WMF 5.1 then you need to repair the system. If earlier then upgrade to WMF 5.1


    Tuesday, August 28, 2018 9:22 PM
  • What are the results of those commands?

    get-module PackageManagement -ListAvailable


    if not defined, try to do it:

    Set-PSRepository -name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/


    Peter, MCITP

    • Edited by eissko Tuesday, August 28, 2018 9:39 PM
    Tuesday, August 28, 2018 9:25 PM
  • Hi Peter,

    The command throws this error:

    Set-PSRepository -name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/
        Directory: C:\Program Files\WindowsPowerShell\Modules
    ModuleType Version    Name                                ExportedCommands                                                                                                                                       
    ---------- -------    ----                                ----------------                                                                                                                                       
    Binary    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                 
    WARNING: Unable to find module repositories.
    Set-PSRepository : The specified Uri 'https://www.powershellgallery.com/api/v2/' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
    At line:5 char:1
    + Set-PSRepository -name PSGallery -SourceLocation https://www.powershe ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (https://www.pow...ery.com/api/v2/:String) [Set-PSRepository], ArgumentException
        + FullyQualifiedErrorId : InvalidWebUri,Set-PSRepository

    Any clue!!



    Friday, August 31, 2018 5:27 PM
  • Firewall?  Proxy server?  You will have to  troubleshoot you connectivity.  We cannot do that for you.


    Friday, August 31, 2018 5:51 PM
  • How can I install the SQL module on Prod server without connecting to internet because on Prod server we are not allowed to connect to internet? Is there any other alternative way to install or import SQL module?
    Tuesday, September 4, 2018 12:59 PM
  • Install module first on a machine which has access to the Internet.

    Then save this module, copy it to the PROD server and Import module

    help get-module
    help save-module
    help import-module

    Please click on Propose As Answer or to mark this post as and helpful for other people. This posting is provided AS-IS with no warranties, and confers no rights.

    Tuesday, September 4, 2018 2:31 PM
  • Is there a direct way to download the module into a specific directory and run it. I tried with these options but they are not working for me.
    Tuesday, September 4, 2018 8:36 PM
  • First you find and download the module:

    Find-Module -Name "sqlserver" -Repository "PSGallery" | Save-Module -Path "C:\temp\"

    Then you copy the module to the PROD server, and run the Import-Module cmdlet.

    P.S. Make sure that you copy the module to one of the module paths. You can check this by running:


    C:\Users\Vladimir\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\

    The paths are separated by semicolon

    Please click on Propose As Answer or to mark this post as and helpful for other people. This posting is provided AS-IS with no warranties, and confers no rights.

    • Edited by Vlad817263 Wednesday, September 5, 2018 6:06 AM
    Wednesday, September 5, 2018 6:05 AM