Module: biz.dfch.PS.System.Data

This module provides Cmdlets that let you work with Microsoft SQL Server database (regular and LocalDB) by utilising System.Data.SqlClient (instead of relying on the buggy ‘SqlServerCmdletSnapin100’ snapin and its ‘Invoke-Sqlcmd’ implementation. You can set a ‘DefaultPrefix’ or an alias to call it the same as the Microsoft SQL Server supplied ‘Invoke-Sqlcmd’.

Furthermore you can work with LocalDB instances (as used by Visual Studio and others) by specifying a connection string such as:
‘Data Source=(LocalDB)\v11.0;AttachDbFilename=”C:\VS\prj1\bin\Data\ApplicationDatabase.mdf”;IntegratedSecurity=True;Connect Timeout=30’

Again this module is published under the Apache 2.0 license.

You can download the module on GitHub at or you can get it on NuGet with ‘Install-Package biz.dfch.PS.System.Data’ (

CommandType Name                    ModuleName
----------- ----                    ----------
Function    Invoke-SystemDataSqlCmd biz.dfch.PS.System.Data



* This module updates and enhances the previous implementation of my ‘Invoke-SqlCmd‘.

* For a description on ConnectionStrings and SqlConnectionStringBuilder with LocaolDB see:

SqlClient Support for LocalDB

* For a description on PSBase which is needed to work with the ConnectionStringBuilder see:




  1. […] === UPDATE 2014-10-19 === I created a separate module that uses the SqlClient where you do not have to specify the command type === For the full module and description see my Post Module: biz.dfch.PS.System.Data. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: