Share via

How to Script the Create script for a SQL Agent job without access to SQL Agent

alhowarthWF 301 Reputation points
2023-07-25T20:01:37.1533333+00:00

We have permissions to msdb on a SQL 2016 server, but not the SQL Agent GUI in SSMS. I have a job that I created using Toad Data Point. I need to generate the Create script to move it to higher environments, where we don't have permissions to msdb. Is there anyway to do this?

Otherwise, I'll ask the DBAs.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
2023-07-25T20:10:09.92+00:00

If you don't see the Agent node in SSMS, this would indicate that you are not in the required SQLAgent role for the actions you can do from the Agent UI, and that includes scripting.

If you have SELECT permission on sysjobs, sysjobsteps etc, you get the details that way, but then you need to know what you are doing. It seems easier to ask the DBAs...

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. alhowarthWF 301 Reputation points
    2023-07-25T20:17:19.09+00:00

    I posted this question after Googling for 20 minutes. Then I added PowerShell to my query and found a great script: https://www.johnsansom.com/script-sql-server-agent-jobs-using-powershell/

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.