Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke-Sqlcmd cmlet missing in Powershell core sqlserver module for linux

I am using latest version of Powershell core on Linux Ubuntu 16.04. I am trying to query a sql server database using powershell's invoke-sqlcmd cmdlet. (Yes I have installed the sqlserver module) I get an error which says that it cannot find the cmdlet. The command is there in windows powershell when I install the sqlserver module. Screenshot of the same

Does invoke-sqlcmd only work on Windows? If yes,is there another way I can achieve the same result in powershell core.

like image 255
Neel Avatar asked Oct 17 '22 13:10

Neel


1 Answers

With Powershell core (6.2.3 at the time of this writing), you can install the sql server module like so:

Install-Module -Name SqlServer

and then you can call invoke-sqlcmd

If you want to know more about it: http://sqlvariant.com/2019/03/invoke-sqlcmd-is-now-available-cross-platform-in-the-sqlserver-module/

like image 69
Yepeekai Avatar answered Oct 21 '22 05:10

Yepeekai