using "pushd" from Job using CmdExec

  • Hello,

    For months I've been trying to run a job (using the SQL Server Service Account) that calls a batch file on a remote server which in turn calls Gpg4win to encrypt a file. (I have been putting the project down and picking it up.)

    I haven't been able to get the job to call a SSIS package that calls the batch file (using an Execute Process task) under the Service Account credentials. The job always hangs. (I'm pretty sure there is no "Y/N" dialogue that is holding things up. When I run under my credentials, no dialogue box appears.)

    In an effort to get something to work, I've been trying to create a job under the Service Account that calls the CmdExec. I have managed to get the service account to create a test file with this DOS instruction:

    dir "\\myServer\myShare\*.csv" > "\\myServer\myShare\Test_file.txt"

    Believe me, I was happy to see the Service Account actually do something.

    Now I wish to expand the process like so:

    pushd "\\myServer\myShare\"

    dir *.csv > Test_file.txt

    popd

    However, the CmdExec for SQL jobs doesn't appear to do anything with "pushd" or "popd". When I execute the commands directly above the CmdExec job succeeds, but I have no idea where the output file went. It isn't on the remote server (i.e., \\myServer).

    Does anyone know how to get a job running the CmdExec to change the current directory to a remote server? All help appreciated. Thanks!

  • Where I wrote:

    "I haven't been able to get the job to call a SSIS package that calls the batch file (using an Execute Process task) under the Service Account credentials. The job always hangs."

    What I should have said is that I have reduced the batch file that the SQL Server Service Account is attempting to run to just these lines:

    pushd "\\myServer\myShare"

    dir *.csv > Test_file.txt

    popd

    Even with the batch file reduced to just this, the job hangs when calling a package that calls this batch file using the Execute Process task, using the Service Account's credentials.

    I wish it were easier to fix permissions issues using the SQL Server Service Account in SQL Server.

    Thanks,

Viewing 2 posts - 1 through 1 (of 1 total)

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