Chapter 6. Monitoring and Automating SQL Server

This chapter covers how SQL Server usage and performance monitoring, logging, alerting, and error checking can be done with PowerShell. The topics covered in this chapter include the following:

  • Getting to know helpful cmdlets
  • Scheduling PowerShell scripts
  • Checking logs
  • Monitoring failed jobs
  • Alerting on disk space usage
  • Logging blocked processes
  • Getting performance metrics

Getting to know helpful cmdlets

Before we start covering any SQL Server-specific snippets, it's good to identify cmdlets that are frequently used when you are monitoring and logging any activities. The cmdlets described in this section are the ones you will (most likely) frequently use. Remember to use Get-Help to get the full documentation ...

Get PowerShell for SQL Server Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.