Problem Scenario

User configured a Job to execute simple Windows command to copy file from folderA to folderB. Source directory is an local directory but target directory is an shared drive/Samba mount on Windows server. User reported that when he try to execute same command from CMD prompt he has no problem, but same command when configured to run from JobScheduler throws "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 Service on Windows Server, Windows Service has a special Service User which may or may not have same right as user logedin/installed the JobScheduler or even administrator user.

To see what user right JobScheduler is running with , user can execute command whoami /all on CMD prompt and also insert same command in JobScheduler Job.
One can compare User Rights given to Windows Service user and Admin user from CMD prompt and JobScheduler job's 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>