Saving all sql server agent jobs

Victor 66 Reputation points
2023-02-07T19:35:06.5033333+00:00

Hello,

I know there is a powershell script out there to copy all sql server agent jobs (dbatools). Is there a sql script to backup (basically, script out all the sql server agent jobs) and copy them to a local folder? Example: If there are 10 sql server agent jobs, create 10 separate script files and dump it to d:\sqlserveragentjobs\ folder.

Will appreciate your help.

Thanks.
Victor

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,714 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PercyTang-MSFT 12,426 Reputation points Microsoft Vendor
    2023-02-08T01:56:50.79+00:00

    Hi @Victor

    If you need a sql script, you can refer to the links.

    https://www.databasejournal.com/ms-sql/generate-scripts-for-sql-server-objects/

    https://stackoverflow.com/questions/3361163/automatically-create-scripts-for-all-sql-server-jobs

    Best regards,

    Percy Tang


    If the answer is the right solution, please click "Accept Answer". If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments