Scheduling PowerShell scripts

Many of the examples covered in this chapter can be run ad hoc. However, to enable more continuous monitoring, you will need to schedule these scripts to run regularly. You can use a number of options for scheduling. You can take advantage of SQL Server Agent and you can create a job that uses either a PowerShell step or an Operating System (CmdExec) step. Alternatively, you can use Windows Task Scheduler or vendor-specific schedulers, if they are available to you.

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.