Managing jobs

You can list information on the current job server and the related jobs. Once the SMO server is set up, you can list the properties by using the following command:

$server.JobServer | Select-Object *

A long list of properties will be displayed. A partial list looks like the following screenshot:

Managing jobs

Notice that information on the job server includes the service account, job categories, alerts, operators, jobs, proxy accounts, and shared schedules.

To list details about the jobs, you can use the same JobServer object and iterate over all the jobs in that collection. Each SMO Job object contains information about the job name, last run date, ...

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.