Task Scheduler in Windows 2008 Server Standard

What's the general trick to get the same command you can successfully use Run with in a Scheduled Task in 2008?  I didn't have problems on a 2003 Server.

I've got two Scheduled Tasks that run fine from a Run window and a Shortcut but they immediately stop and produce Return Codes as Scheduled Tasks:

The first one is a relatively simple batch file -
   "\\server\share\folder\folder\file.cmd"
produces a Return Code of 9009.  The CMD file was selected using the Browse button in the Add Action window.

The second runs a local program with several parameters -
   "C:\Program Files (x86)\vendor\program.exe" -x "\\server\share\folder\folder\parameter.file"
produces Return Code 143.  2008 moves the parameters into the Add Arguments box automatically.

Thanks in advance!
Wade_ChestnutAsked:
Who is Participating?
 
Wade_ChestnutConnect With a Mentor Author Commented:
I finally got it to work!  Even though I could execute the single command in a CMD file (and it worked in 2003), I had to add a NET USE to a network drive, select that drive letter, then Change Directory to where the parameter file resided.  That makes no sense to me but at least it works.  Thanks for the suggestions!
0
 
JHallidayChief Technical OfficerCommented:
Are you specifying a username name to run the tasks as ?

(See highlighted area in the image)
EE-25504151.jpg
0
 
Wade_ChestnutAuthor Commented:
Not at first because I'm troubleshooting the problem now.  I will eventually want the task to run with the user logged off.  I'm just running them manually to help simplify the problem.
I did take the first one and put it into a CMD file and that worked for some reason.  I'm still troubleshooting the second one.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
JHallidayChief Technical OfficerCommented:
Can you send me a snapshot of your scheduled task window ?
0
 
JHallidayChief Technical OfficerCommented:
It may need to run in elevated permissions (Run with Highest Privileges checkbox at the bottom)
0
 
JHallidayChief Technical OfficerCommented:
Ah actually that makes perfect sense.  When you run an application in Task Scheduler its almost like logging on as a new user (even though you may be already logged in) the problem is it doesn't run any log in script or map any drives you may have cached etc so if you are accessing files on a network drive you either have to use an absolute path (i.e. \\server\share\directory\file) or have a line that maps the drive in the CMD file.  Glad you got it sorted :)
0
 
Wade_ChestnutAuthor Commented:
JHalliday, I was actually using the UNC path to the network share, but it didn't like that for some reason.  I copied the exact command line (with the UNC path) from the 2003 Scheduled Task into the 2008 Task and it didn't work.  I tried looking for a "proper" way to create new Actions in 2008 thinking they changed something and I was doing something wrong but I couldn't find anything.  Oh well.  At least it does work now.  Thanks for replying.
0
 
JHallidayChief Technical OfficerCommented:
Was your CMD file using a network path of some description ?
0
 
Wade_ChestnutAuthor Commented:
"...of some description?" -- not sure what you mean by that.  
It was using the same UNC path as the previous Windows 2003 Server directly pointing to the folder on the NAS, and I even added the same UNC path to the "Start in (optional) field.
0
All Courses

From novice to tech pro — start learning today.