Try psexec'ing into the server as the user and running the batch file. You will then likely see the error. I had a similar problem with batch file running normally but not with 08 R2 Task Scheduler. It would run if "Only run when user logged in", but not when "Run whether user is logged on or not". Turned out something was trying to access drives by drive letter. I'm not sure if this was programmed directly or 08 was trying to be smart and converting the UNC path to a mapped drive. My ini file for the program only had UNC paths though.
Obviously drive letters aren't mapped when user not logged on.. I ended up having to map the drive in the batch file with credentials it doesn't pass through. It then worked. Make sure the user running the tasks has premissions to the batch file and any network shares. Then pick "Run whether user is logged on or not" and checking the "Run with highest privileges" checkbox on the General tab.
Start - Administrative Tools -Local Security Policy - Local Policies - Security Options - "Network access: Do not llow storage of passwords and credentials for network authentication" -disabled by default, switch to enabled.
Make a. In first line change to the directory of your exe. In the second line call your exe like this:. Sign up to join this community. The best answers are voted up and rise to the top. DateLastModified objFile. To be honest I'm having my own issues with R2 not wanting to run my scripts properly at the moment. But I want to get mine to copy a file from one server to a bunch of others, do a compare and produce a report as its going through.
Running it normally by simply double clicking the icon works perfectly, however I stick it into the scheduler.. Other than a few words of solidarity the only thing I can think off, is when your putting it into the scheduler are you setting the task to run as SYSTEM because I know it defaults to your own account, and get it to run regardless of who is logged in.
As this is how I'm trying to get my script to run, but I dont appear to have any issues local on the machine as its producing the report etc its just all the external stuff it isnt doing.. I have a weird work around for the moment. Basically, I created a VBScript to call the. I simplified things a little bit off of what he recommended above, but it seems to be working properly now when launched from task scheduler. I still would like to write my script in powershell to eliminate the extra 'moving parts' of the VBScript calling the.
Originally when I was trying this out it wasn't working. I'll have to try that again, maybe I didn't have it piped correctly last time.
This is perfect thank you! I have found a handful of forums stating R2 has issues with batches. Some have stated that R2 will not execute batches via task scheduler if there are quotations in the code. I have an inkling that it may be a rights issue. I have tried a plethora of combinations with varying results, none of which have been successful.
I have had luck running batch files on R2, however it wasn't as straight forward as it should be, but it does work.
Some of the biggest things being, on the general tab of the scheduled task, check the box for "Run with highest privileges" and then below that, the drop down should be set to "Windows Vista, Windows Server ". Then in the "Start in" path I have the path to the last directory up to the script and NOT in quotes. Thank you for the suggestions. After implementing them, I was still getting unexpected results.
So, after some direct monitoring of each line in the batch, I think I have figured it out. The batch was using the "move" command, sending files from a local disk source to a mapped drive destination.
I thought the "move" command may have been the limitation. So tried using "robocopy" instead robocopy offers a lot more error logging, and I think R2 prefers it. Robocopy led me to find that the mapped drive may be the weak link. So I used the direct UNC, low and behold, it worked when induced from task scheduler. It turns out for us that the "Start in" field needed something. By putting the full path of the script without quotes as Jay suggested, now the task runs without errors. I guess I shouldn't be surprised, in retrospect.
The scheduled task should run at its designated time. You may manually run the task anytime by right-clicking the task and clicking Run. All rights reserved. Try These Solutions. Notify me of follow-up comments by email. Notify me of new posts by email. Post navigation Previous Post. Next Post.
0コメント