Friday, January 18, 2008

Scripting SQL Management Objects in Windows PowerShell



This book, by Willis Johnson, shows how to communicate with SQL Server using SQL Management Objects in Windows PowerShell scripts.

Topics include how to create Windows PowerShell scripts that use SQL Management Objects (SMO) to manage and program SQL Server.   

In addition, you will learn about areas of potential difficulty and see how to avoid them—for example, the use of '$' in instance name, quote nesting rules, connection pooling, and schemata.


The scripts :

  • Load SMO
  • Create a server object; get a user’s credentials from the UI into a safestring
  • Connect to SQL Server using SQL Server authentication
  • Connect to SQL Server using Windows authentication
  • Profile a server instance by examining its properties
  • Use WMI to examine and configure a server’s Windows service
  • Use PowerShell cmdlets to start, stop, and restart a service; check for the existence of a database
  • Verify a file path
  • Save data in a csv file
  • Retrieve data from a csv file
  • Create a database, a schema or a table
  • Insert data in a table
  • Execute ad hoc T-SQL queries
  • Retrieve information about views
  • Create reports in HTML format
  • Display HTML reports in a browser window
  • Launch a Windows process
  • Tweak data format

    A downloadable ZIP archive is included which contains all the example scripts, as well as additional scripts.

The electronic version of the book is available for only US $6.99.


Unknown said...

I love your blog..thanks for all the information! This book looks useful!

Shay Levy said...

Thank you Chrissy

It's pretty cold down here this days but your comment warmed my heart!