Help with a job step (calling an exe)

  • Hi everyone,

    I have inherited a job that is calling a maintenance plan. The maintenace plan makes a back-up of various databases.

    I have to add a step to add to encrypt the backup. I have the exe already. Its called "EncryptBackup.exe"

    My difficulty is I do not know how to add the step to the job exactly. The command syntax eludes me a bit. The syntax for the encrypter exe is:

    C:\exes\EncryptBackup.exe C:\DBBackup\FolderA Encypt filename.bak

    The output is "filename_encrypt.bak". It should be noted that there exists several sub-folder off: C:\DBBackup like FolderA, FolderB, etc...each one holds a database

    Can you help me please? I would really appreciate any assistance/advice/examples you can provide.

    I am including the job for your convenience.

    Thanking you,

    J.

  • It's not clear exactly what you're struggling with. Have you tried adding a new job step with CmdExec subsytem, with a command something like this:

    C:\exes\EncryptBackup.exe C:\DBBackup\FolderA Encypt filenameA.bak

    C:\exes\EncryptBackup.exe C:\DBBackup\FolderB Encypt filenameB.bak

    C:\exes\EncryptBackup.exe C:\DBBackup\FolderC Encypt filenameC.bak

    ...

    By the way, please don't back up your databases to your C drive.

    John

  • Thanks John - the problem is that the "filenameA.bak" changes name (there is a timestamp appended to it). I need some way to reference it. Can you help?

    C:\exes\EncryptBackup.exe C:\DBBackup\FolderA Encypt filenameA_changingTimestamp.bak

  • You need to find some way of enumerating the files in the folder and then processing them one by one. That may be by running a dir command via xp_cmdshell and dumping the results into a temp table, it may be a Powershell script that you write, or you could create an SSIS package for it.

    John

  • Thanks John for your comments. I got this sorted with this article:

    https://www.mssqltips.com/sqlservertip/1618/using-the-forfiles-command-to-delete-sql-server-backups/

  • Just a question, if you're using 2014, why not use the backup encryption provided?

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply