Solved

How to get Task Scheduler to run BAT correctly

Posted on 2014-09-23
3
361 Views
Last Modified: 2014-09-23
Hello,

I have a scheduled task to run a BAT file that is suppose to delete some files at 9:00 PM daily.  The OS is Windows Server 2012.  The task starts and runs with the account that the task is using.  I have logged into the server with a different account and scheduled a time for it to start and it starts and the BAT deletes the files.  So, all is good. However, when no one is logged into the server and when 9:00 PM comes around the task starts, but the del command in the BAT fails to delete the files.  I have set the task to "Run with highest privileges"  and run whether user is logged on or not.  But, the del command does not remove the files.   Here is the del command:

del \\server\d$\SQL-Backups\*.bak /f /q

Any ideas on what could be going on?

Thanks
0
Comment
Question by:PBIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
Brian Pringle earned 500 total points
ID: 40339841
You need to explicitly give the user account that is set to run the task full control file permissions to the folder containing the batch file, as well as the batch file itself.  For some reason, user group membership does not propagate unless the user is logged in.
0
 
LVL 34

Expert Comment

by:it_saige
ID: 40339876
Also ensure that the user is given the permission; "Log on as a batch job" in the Local Computer Policy -> Security Settings -> User Rights Assignment.

-saige-
0
 

Author Comment

by:PBIT
ID: 40339917
Ok I will check both of these things.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question