PowerShell is all the rage! It is deeply integrated in SQL Server 2008, where you can start a PowerShell session from Management Studio, and create job steps which execute PowerShell scripts. SQL Server 2008 will also introduce some great new cmdlets. This integration of PowerShell in SQL Server 2008 will introduce a number of useful scenarios for centralizing administration and management of your SQL Server environment. I will be showing some different solutions in the upcoming months, but thought some of you may be interested in resources to learn the scripting language – and learn it in the context of SQL Server administration.
The first resource I would recommend would be a series of articles by my colleague and friend Buck Woody. Buck is on the team which is delivering Management Studio in SQL Server 2008 (http://blogs.gotdotnet.com/buckwoody/archive/2008/04/03/microsoft-loves-dba-s.aspx). One of the great things about Buck (besides his movie star name and incredible personality) is that he uses his many years as a DBA, MVP, and team manager in his articles to make features and capabilities real for the database community. Buck has written a SQL Server Reference Guide, and the PowerShell sections begin here (http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=253). This is a great introduction to scripting with PowerShell and perfect if you are very new to scripting and PowerShell. Mind – you will not walk away from these articles as an expert PowerShell programmer – but it will give you the tools to get started.
SQL Server 2008 Books Online includes a number of links for learning PowerShell (http://technet.microsoft.com/en-us/library/cc281954(SQL.100).aspx ). I would anticipate that more Microsoft links will be coming as we near the release of SQL Server 2008.
Allen White has also been writing different examples for using PowerShell with SQL Server (http://sqlblog.com/blogs/allen_white/archive/tags/PowerShell/default.aspx). His examples provide some context to using PowerShell in your SQL Server environment.
I hope these few online resources help get you started. Of course, there are a plethora of books available on the topic of PowerShell, although I have not seen one that is specifically written for SQL Server.
On that note: Please share your resources in the comments. Let us know of those great PowerShell books or articles for DBAs!