Fundamentals of PowerShell for DBAs
Daily maintenance tasks got you down? Ever wanted to automate your busy work away, but you weren’t sure where to start? If so, then PowerShell is a tool to help you do just that. Whether you want to configure your physical or virtual servers, work with your file systems, and yes, even administer SQL Server, PowerShell can do all of those things very easily and efficiently.
In this recorded online class, you’ll learn the basics of PowerShell: we’ll start out with what it is, how the syntax works, and how you can do some essential and routine work by writing scripts. From there, we’ll focus on using PowerShell to administer SQL Server: how we can connect to SQL Server with PowerShell and how to get information about your instances. We’ll also write scripts together during the class for more complex tasks such as working with database objects, exporting and importing data, and even doing permissions audits with both SQL Server and Active Directory.
This class will feature a lot of interactive code examples that you’ll write with me so we can step through the logic and execution to help you build your own scripts for your daily work.
Note that this class is taught with Windows, and uses Windows drive letter & pathing examples. If you’d like to follow along on Mac or Linux, be aware that you’ll need to change the paths as you go.
About the instructor: Drew Furgiuele is a Microsoft MVP who has been working with SQL Server for over 15 years. He loves automation with T-SQL and PowerShell, and in his spare time, launches SQL Server into space with balloons.
Your Progress So Far in This Class
This is driven by the mark-as-complete buttons in each module of the class. (Let’s be honest: you’re probably just going to mark them as complete because you’re that kind of student. I feel you.)
- 1.1 Welcome and Class Roadmap
- 1.2 How Drew Sets Up His Workstation
- 1.3 Setting Up Your Computer
- 2.1 What’s PowerShell?
- 2.2 Using Variables and Lab 1 Assignment
- 2.3 Using CMDLETs and the Pipeline
- 2.4 CMDLETs: Aliasing and the Pipeline
- 2.5 Lab 2 Assignment
- 3.1 Working with Objects
- 3.2 Object Properties and the Pipeline
- 3.3 Object Methods
- 3.4 Making Your Own Objects
- 3.5 Lab 3 Assignment
- 4.1 Logical Operators and Loops
- 4.2 Filtering with WHERE
- 4.3 WHILE Loops
- 4.4 IF – THEN – ELSE
- 4.5 Lab 4 Assignment
- 5.1 Functions and Parameters
- 5.2 Parameters and Error Handling
- 5.3 Lab 5 Assignment
- 6.1 The SQL Server PowerShell Module
- 6.2 The SQLSERVER:\ Drive
- 6.3 Working with SQLSERVER:\ Objects
- 6.4 Lab 6 Assignment
- 7.1 Scripting SQL Server Objects with PowerShell
- 7.2 Objects and Namespaces
- 7.3 Lab 7 Assignment
- 8.1 PowerShell and the SQL Server Agent
- 8.2 Creating Agent Jobs with PowerShell
- 8.3 Scheduling PowerShell Job Steps
- 8.4 Lab 8 Assignment
- 9.1 Auditing Permissions with PowerShell
- 9.2 Exporting Permissions to CSV
- 9.3 Lab 9 Assignment
- 9.4 What’s Next for You