Complete a Server Assessment – Email Addresses In Job Steps

Below you will find the code to look for email address in job steps.  This code only looks for .COM, .EDU, .GOV and .ORG addresses.  The where clause can easily be modified to include more.  Simply select the text and copy to the Clipboard.

SELECT
j.name
, p.step_id
, p.step_name
, j.enabled
FROM msdb.dbo.sysjobs j
INNER JOIN msdb.dbo.sysjobsteps p
ON p.job_id = j.job_id
INNER JOIN master.dbo.sysservers s
ON s.srvid = j.originating_server_id
WHERE p.command LIKE N’%@%.com%’
OR p.command LIKE N’%@%.edu%’
OR p.command LIKE N’%@%.org%’
OR p.command LIKE N’%@%.gov%’

This code was written using the Microsoft SQL Server documentation.  If you find that this code was copied from else where, please let me know so I can give proper credit.