Stairway to SQL PowerShell
PowerShell is a powerful scripting tool that allows you to automate routine tasks, and script administrative tasks, allowing you to automate a lot of the routine work in a SQL environment. Ben Miller's Stairway Series introduces PowerShell from the beginning, guiding you through how to configure and get started with the framework before working towards more advanced scripting.
- What are PowerShell and SQL PowerShell and how do you use them? Level 1 of this Stairway will help you answer these questions, and start to show you why you might want to use this great tool.
- Now that you know how to get started with PowerShell, it is time to configure PowerShell for SQL Server use. This level covers the components you'll need and how to configure them.
- This level will cover some of the Input/Output operations you can use with PowerShell.
- This far, we have learned about installation and setup of the PowerShell environment. You should now have a foundation of SQL Server PowerShell. We now are ready to learn about Objects in SQL PowerShell.
- You should be on your way with PowerShell with the previous levels and now the topic shifts to using Functions and Assemblies built in to .NET for use with automation. This topic will be used in your PowerShell adventures throughout your career and this Stairway.
- In this level, we will walk through creating and using modules for PowerShell. Modules are simply a collection of functions that are most likely related to each other and packaged in a way that allow you to import them as a group.
- In this level we begin our journey into the SQL Server SMO space. SMO stands for Shared Management Objects and is a library written in .NET for use with SQL Server. The SMO library is available when you install SQL Server Management Tools or you install it separately.
- In this level we continue our journey into the SQL Server space by looking at the SQL Provider that comes with modules for PowerShell. You saw a little bit of the provider for SQL 2008 R2 in Level 2 of this Stairway.
- This level will show how to create objects including a login, a database, a filegroup, a file a database user and then we’ll end with a table and an index.
- In this level we will look at ways of getting data into and out of SQL Server. We will specifically look at the Database object and a cmdlet Invoke-Sqlcmd or Invoke-SqlCmd2. To get data in, we are going to leverage a PowerShell script that uses SMO to put data into a predefined table in SQL Server.
- This level will demonstrate simple techniques to perform a few important SQL Server maintenance tasks using PowerShell. We'll barely scratch the surface of what's possible but I hope it will whet your appetite.