Created
August 3, 2021 19:16
-
-
Save sneakymonk3y/d8c0dee3a5824fedb4fc520aeeecebf5 to your computer and use it in GitHub Desktop.
MSSQL Agents Jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT job.job_id as [JOB_ID], | |
job.name as [JOB_NAME], | |
job.description as [JOB_DESCRIPTION], | |
steps.step_name, | |
steps.subsystem, | |
steps.command, | |
SUSER_SNAME(job.owner_sid) as [JOB_OWNER], | |
steps.proxy_id, | |
proxies.name as [proxy_account], | |
job.enabled, | |
steps.server, | |
job.date_created, | |
steps.last_run_date | |
FROM [msdb].[dbo].[sysjobs] job | |
INNER JOIN [msdb].[dbo].[sysjobsteps] steps | |
ON job.job_id = steps.job_id | |
left join [msdb].[dbo].[sysproxies] proxies | |
ON steps.proxy_id = proxies.proxy_id | |
ORDER BY JOB_NAME, step_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From https://www.slideshare.net/nullbind/beyond-xpcmdshell-owning-the-empire-through-sql-server