Problem Scenario

  • User configured a job to execute a simple Windows command to copy a file from folderA to folderB. 
  • The source directory is a local directory but the target directory is a shared drive/Samba mount on a Windows server. 
  • The user reported that when he tries to execute the same command from the CMD prompt he has no problem, but the same command when configured to run from JobScheduler throws an "Access denied" error.

JobScheduler example Job

<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
    <script  language="shell">
        <![CDATA[
           copy c:/outbound/test.txt d:\reports\daily
        ]]>
    </script>

    <run_time />
</job>

JobScheduler runs as a Service on a Windows Server. The Windows Service is assigned a service User which may or may not have the same permissions as the user who loged in/installed the JobScheduler.

To see what user permissions JobScheduler is running with you could execute the command whoami /all on the CMD prompt and add the same command to JobScheduler in a job.
Starting from this you could compare the user permissions assigned to the Windows Service user and to the user from the CMD prompt and from the JobScheduler job log.

JobScheduler example Job with whoami /all command

<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
    <script  language="shell">
        <![CDATA[
         whoami /all
         copy c:/outbound/test.txt d:\reports\daily
        ]]>
    </script>

    <run_time />
</job>