Install Invoke-Sqlcmd (SQLPS) - PowerShell Extensions for SQL Server


Install invoke-sqlcmd downloading the mentioned Features Packs using the following Microsoft Download link for latest SQL Server® Service Pack 3 (Sep 15, 2021)

Common error

Invoke-sqlcmd : The term ‘Invoke-sqlcmd’ is not recognized as the name of a cmdlet, function, script file, or operable


Install the Microsoft SQL Server 2016 Feature Pack’s PowerShell Extensions for SQL Server. You’ll be able to run 'Invoke-sqlcmd' in Powershell after it’s installed.

Download MSI packages

Download below installation files from Microsoft® SQL Server® 2016 Service Pack 3 Feature Pack site.

  • Microsoft® System CLR Types for Microsoft SQL Server® 2016 (SQLSysClrTypes.msi)
  • Microsoft® SQL Server® 2016 Shared Management Objects (SharedManagementObjects.msi)
  • Microsoft® Windows PowerShell Extensions for Microsoft SQL Server® 2016 (PowerShellTools.msi)


Install them following below order

  1. SQLSysClrTypes.msi
  2. SharedManagementObjects.msi
  3. PowerShellTools.msi

Reboot or downtimes are not required.

Video recording

Below video recording demonstrates the same procedure. You can play if you want see more details.


After installation open a new PS window and that should be working. You can try below syntax to query any SQL instance.

Invoke-sqlcmd -ServerInstance "Server\\Instance" -Query "SELECT GETDATE() AS TimeOfQuery"

Invoke-sqlcmd -ServerInstance “Server\Instance” -Query “SELECT GETDATE() AS TimeOfQuery”



7/5/2022 6:51:57 PM

It’s a solution for the error 'Invoke-sqlcmd' is not recognized as a cmdlet, function, script file, or operable.' Now that it’s working, we can get back to work.

For any questions or suggestions please let me know in the comments.