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.
Invoke-sqlcmd manual install , and invoke-sqlcmd still not reconized
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
Additional SQL Server features and topics not covered by specific categories
3 answers
Sort by: Most helpful
-
CH2 1 Reputation point
2022-10-17T02:12:07.423+00:00 -
CathyJi-MSFT 22,426 Reputation points Microsoft External Staff2021-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 -
Olaf Helper 47,616 Reputation points2021-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