Skip to end of metadata
Go to start of metadata

Accessing mapped network drives (Windows) from a JobScheduler Job

Question:

I'm trying to access a mapped network drive (e.g. X:) from a JobScheduler job. The drive can be accessed from outside JobScheduler but within a Job it doesn't exist.

Answer:

This behavior is more of a Windows feature than a JobScheduler bug. On Windows JobScheduler runs as a service and services are started by a process which is started very early when the operating system starts up. That happens long before the network drives are mounted, which happens when a user logs on.

In order to access a network drive from JobScheduler, you need to mount it in the JobScheduler process. This can be done in the startup script of JobScheduler. In detail, do the following:

  • Make sure JobScheduler is running as a user that has permission to access the network drive(s) (Check the services configuration to set a different user).

  • Configure a scheduler start script to mount the network drive:

  • Put the <script> element into config/scheduler.xml file between the <process_classes> and <http_server> elements.

  • Restart the JobScheduler

Note that this problem might have to do with the moment that the process which starts the services is started. If the environment variables do not yet exist, then they cannot be inherited by the services. See if it changes when you change the user that runs the service.