6 Jul

SQL with its own Powershell?

SQL Server 2008 and powershell are strongly integrated. In fact, SQL Server 2008 comes with its own Powershell. Microsoft SQL Server Powershell also known as SQLPS is basically a custom shell built to be used just for SQL Server. SQLPS comes preconfigured with all SQL Server extensions.

Technically speaking SQLPS is a mini-custom-powershell which has multiple Snappins created for SQL Server with its own custom cmdlets (pronounced as command-lets). SQLPS is a great tool to Administer, Monitor or Automate your SQL tasks provided you don’t go beyond SQL, means you can’t add other snappins to SQLPS. This makes it a “CLOSED” shell.

SQLPS uses two Snappins SqlServerCmdletSnapin100 & SqlServerProviderSnapin100. We can use Get-PSSnapins cmdlet to see all loaded\configured snapppins.

If you’ve any exposure to Linux or command prompt, Learning Powershell is very easy. Microsoft did a fabulous job and tried hard to provide the same look and feel + your (few) favorite commands are also compatible in powershell.

Yes, that means if you are coming from Windows background and love to use command prompt you can adopt powershell and start using just like another command prompt with commands like dir, cd and the same is true for Linux experts since powershell supports ls, man etc. Microsoft did this using Aliases Dir, ls are Alias for Get-ChildItem.

Sarabpreet Singh Anand

About Author:

SQLServer - MVP Sarabpreet is SQLServer MVP, Consultant, Speaker, Trainer, Blogger and Community Lead. You can find him speaking at a local UG Event or a SQL Webcast. He has 11+ years of Experience and worked with Industry Leaders. He has many SQL Certifications under his belt. His core competency lies in administration of SQL Server. Always ready to help, online \offline. His life’s mantra is “Knowledge Increases by sharing so, Pass it on”.

Leave a Reply

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