Share via

Invoke-sqlcmd manual install , and invoke-sqlcmd still not reconized

sakuraime 2,351 Reputation points
2021-05-13T13:39:31.767+00:00

I have manually install sqlserver powershell module .
https://www.powershellgallery.com/packages/Sqlserver/21.1.18245

and follow the below link steps
https://sqlserverunlimited.com/2019/08/01/powershell-install-sqlserver-module-offline/

after that I can see Sqlserver module are listed , however 'invoke-sqlcmd' still not reconized .

anything is missed. ? I have restart powershell, restart server but no luck.

and it's windows server 2016 and powershell module 5.1

and I am not able to use Install-Module command to install as there is no internet for the server .

Windows for business | Windows Server | User experience | PowerShell
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


3 answers

Sort by: Most helpful
  1. CH2 1 Reputation point
    2022-10-17T02:12:07.423+00:00

    Hi, I use SSMS... thks for OlafHelper-2800's idea!
    You should right-click on your database then click "Start Powershell" and try your query in the newly opened SQL Server Powershell. It works for me. Hope this solves your problem.

    Was this answer helpful?

    0 comments No comments

  2. CathyJi-MSFT 22,426 Reputation points Microsoft External Staff
    2021-05-14T06:33:18.99+00:00

    Hi @sakuraime ,

    After the module has installed, the module commands including the Invoke-sqlcmd should be readily available. Please using below command to check if this module is listed.

    Get-Command -ModuleName sqlserver  
    

    Was this answer helpful?


  3. Olaf Helper 47,616 Reputation points
    2021-05-14T06:29:56.447+00:00

    Download th SQL Modul on a different machin and copy over the installer to server and install it.
    See Install the SQL Server PowerShell module

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.