invoke-sqlcmd Not Recognized

When attempting to run the invoke_sqlcmd from PowerShell you may receive the below exception:

The term ‘invoke-sqlcmd’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The Invoke-sqlcmd cmdlet is not included as part of PowerShell, but instead it is of sqlps (SQL Server 2008 PowerShell Host). Therefore, before using invoke_sqlcmd you should install SSMS  or the SQL Server 2008 Feature Pack . SQL Server 2008 Feature Pack allows you to install sqlps and its required assemblies (SMO and MSMXL 6.0) without any requirement for installing SSMS. When sqlps has been installed, you may then load invoke-sqlcmd into powershell.exe by using the below script:


No comments yet... Be the first to leave a reply!