Chris Umbel

SQL 2008 and powershell

with the 2008 releases from microsoft powershell is really making its way into the mainstream. sql server 2008 ships with standard powershell as well as an add-in that provides an interesting degree of integration that will allow DBAs to write scripts that are far more generalized than T-SQL scripts.

getting ready to play with it is pretty strait forward. all you have to do is click the "Start PowerShell" context menu option which is relatively ubiquitous in SSMS 2008's object explorer, located on the "Tables" folder within a database for example.

essentially the schematic structure of database is layed out into a virtual filesystem with database objects represented as files and directories. for example every table is a directory with subdirectories for each column and each column having files for the more granular properties such as constraints.

the power comes into play when you realize that the virtual filesystem is composed of SMO objects as is illustrated below:

direct sql execution is also supported through the Invoke-SQL cmdlet as shown by the following example:

as you can imagine this barely scratches the surface. for more information I suggest checking out microsoft's documentation here

Sun Jan 25 2009 08:28:16 GMT+0000 (UTC)

Follow Chris
RSS Feed