From 99bace0f3d397bb5b1d1ff35250d186d002114ca Mon Sep 17 00:00:00 2001 From: Scott Sutherland Date: Tue, 20 Aug 2024 09:57:36 -0500 Subject: [PATCH] Create Get-AgentCredentialList.tsql --- templates/tsql/Get-AgentCredentialList.tsql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 templates/tsql/Get-AgentCredentialList.tsql diff --git a/templates/tsql/Get-AgentCredentialList.tsql b/templates/tsql/Get-AgentCredentialList.tsql new file mode 100644 index 0000000..fd07fcf --- /dev/null +++ b/templates/tsql/Get-AgentCredentialList.tsql @@ -0,0 +1,14 @@ +// Get list of credentials used by agent jobs. + +USE msdb; +GO + +SELECT +j.name AS JobName, +s.step_id AS StepID, +s.step_name AS StepName, +c.name AS CredentialName +FROM sysjobs j +JOIN sysjobsteps s ON j.job_id = s.job_id +LEFT JOIN sys.credentials c ON s.proxy_id = c.credential_id +WHERE c.name IS NOT NULLORDER BY j.name, s.step_id;