Wednesday, October 28, 2015

Using the Invoke-Sqlcmd Cmdlet in PowerShell

If you want to be able to run SQL Scripts in PowerShell, you will definitely want to use the Invoke-SqlCmd cmdlet as outlined here:

Unfortunately, the article does not mention how to get the Cmdlet to appear in Intellisense for your PowerShell scripts!

Fortunately, the answer is really rather simple.

You have to add the following PowerShell snap-ins to your PowerShell window:

Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100

Once you have these loaded, you will be able to use the Invoke-Sqlcmd Cmdlet in your PowerShell scripts!!

No comments:

Post a Comment