THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Rob Farley

- Owner/Principal with LobsterPot Solutions (a MS Gold Partner consulting firm), Microsoft Certified Master, Microsoft MVP (SQL Server), APS/PDW trainer and leader of the SQL User Group in Adelaide, Australia. Rob is a former director of PASS, and provides consulting and training courses around the world in SQL Server and BI topics.

Behind the scenes of PowerShell and SQL

Hi! - Great that you've found this page, but it's no longer here! You can find the content over at:

Published Tuesday, February 12, 2013 11:11 AM by Rob Farley



Phil Factor said:

This is all interesting, but, at the risk of being a bit pedantic, I ought to say that your criticisms of PowerShell should really be aimed at SMO. You'd hit the same problem whatever language you use to drive the SMO .NET library. SMO is doing an object/relational mapping for the SQL Server metadata which is never going to be fast. If you really want performance, you can get the best of both worlds by using SMO for the things it is good for, and use SMO's connection (usually the ExecuteWithResults method but you can do a lot more) to use TSQL to get the more complex information you need. This hybrid approach is dead fast, and as efficient as your TSQL.

Examples? Of course! Here

February 12, 2013 5:17 AM

Rob Farley said:

I'm not meaning to criticise PowerShell or SMO - I find them very useful tools. I find PowerShell extremely handy for getting a wide variety of things done - particularly when T-SQL is just plain clunky (although I think PowerShell can be clunky too, such as in that code for creating Defaults). This post is primarily addressing those people who wonder if PowerShell has access to some secret ability behind the scenes, but I hope doesn't come across as being negative.

February 12, 2013 5:29 AM

tobi said:

SMO uses deprected stuff all the time as it seem. For example Table.RebuildAllIndexes used DBCC REINDEX

March 19, 2013 2:01 PM

Sireesh said:

How can we script out a pdw/APS table in powershell?

September 2, 2015 5:40 PM

Rob Farley said:

Sireesh - I'll have to work that out. PowerShell can't hook into PDW in the same way.

September 2, 2015 5:46 PM

Vini said:

Hi Rob,

I am looking for PowerShell script to script out the objects from PDW. Could you please help me with this.



June 12, 2017 5:46 AM
Anonymous comments are disabled

This Blog



No tags have been created or used yet.


News? Haven't you read my blog?

My Company

Can't find something?

Contact Me

Twitter: @rob_farley
Skype: rob_farley

MVP (SQL Server)


Adelaide SQL UG

Privacy Statement