I have an executable JAR file that runs fine under a normal user account. I am trying to schedule this JAR file to run as a System task using Schtasks.exe in Windows Server 2003. The following works just fine to schedule my task:
schtasks /create /tn QCLogger /tr C:\QC_LOGGER\runQCLogger.bat /sc ONSTART /ru System
The task is created correctly and runs. The problem is that the program itself doesn't see the network. When this program is run from a user account, the following directory reference works just fine:
\\casndfgdrtra10\Casdfg10Logs\
When this program is run under a System account, it does not seem to see the network, and thus a call to the directory listed above yields no file results.
Does anyone know how I can fix this? I am open for either a server or coding solution. Please let me know what ideas or questions you have.
Thanks!
UPDATE:
This is in response to the first answer posted, and my attempts:
I am having trouble using the /u and /p in conjunction with the /ru. Here is what I am trying to do (passwords and such have been changed):
schtasks /create /tn QCLogger /tr C:\QC_LOGGER\runQCLogger.bat /sc ONSTART /u ITSERVICES\bv1sfd /p awerwer /ru System
OR
schtasks /create /tn QCLogger /tr C:\QC_LOGGER\runQCLogger.bat /sc ONSTART /u bv1sfd /p awerwer /ru System
Both of those return a syntax error that states: Cannot specify user name without specifying system name. Does anyone know what that means? And how to fix it so that I can run this as a system task while authenticating to the network with these credintials?
/ru
and without/u
//p
, but I've never usedschtask
so can't really help. With your original command line, you might check to make sure that the system account has access to the network resource. My guess is that it doesn't. If you end up having to use/u
//p
, apparently (from the error message) you'll need to use/s
as well.