Solved

Windows Server 2008 R2 - Scheduled Task - bat file

Posted on 2012-03-22
3
3,662 Views
Last Modified: 2012-03-29
I'm trying to get a .bat file to run as a scheduled task.  I can run the .bat file manually without any issues and it only takes about 10-15 seconds to complete.

I'm trying to setup a scheduled task in Windows Server 2008 R2 to run it periodically.  When i run the task from Task Scheduler the status staying running for several minutes until i manually kill it.

The last run result is (0xFF) even though when you look at the history event log for that task it says that it completed successfully.

I've tried running the task with a service AD account.  I added that account to the local security policy to allow to run as batch job.  I've also, just for testing, added that same account as a local administrator.

I've also tried running the task from my account which is a Domain Administrator.

Generanl Tab:
User account" domain\serviceaccount
Run whether user is logged on
Configure for: Windows Server 2008

Actions Tab:
Start a Program
Program/script: "D:\IT Department\Google Apps\AD Directory Sync\Google Apps Sync.bat"

Here is the bat file
@echo ==================================================
@echo ==         Google Apps Directory Sync           ==
@echo ==================================================

@echo ==================================================
@echo ==                Syncing Users                 ==
@echo ==================================================
"C:\Program Files (x86)\Google Apps Directory Sync\sync-cmd.exe" -c "D:\IT Department\Google Apps\AD Directory Sync\Mindshare-GADS-users.xml"

@echo ==================================================
@echo ==                Syncing Groups                ==
@echo ==================================================
"C:\Program Files (x86)\Google Apps Directory Sync\sync-cmd.exe" -c "D:\IT Department\Google Apps\AD Directory Sync\Mindshare-GADS-groups.xml"

@echo ==================================================
@echo ==                  Complete!!                  ==
@echo ==================================================

EXIT

Open in new window




Not sure where to go from here.
0
Comment
Question by:c3very
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
S00007359 earned 500 total points
ID: 37756376
Please check the following;

Log on as a batch job right needs to be assigned to the account that will be used for in the scheduled tasks.

either in local security policy or a gpo in your domain.

also check user access control
0
 
LVL 2

Author Comment

by:c3very
ID: 37759406
I have made sure that the service account is part of the Log on as a batch job in local security policy.  I have also made that user a local administrator to help negate any issues with permissions but it still returns the 0xff result.
0
 
LVL 12

Expert Comment

by:S00007359
ID: 37785031
deploy a gpo allowing your service account . or possibly your default domain policy is overridding your local security policy.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

If you migrate a Terminal Server licenses server inside the 2008 server family, you can takte advantage of the build-in migration tool. If you like to migrate an older 2003 Server (and the installed client CALs) to a 2008 R2 server for example, you …
This article explains how to install and use the NTBackup utility that comes with Windows Server.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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 to another domain controller. Log onto the new domain controller with a user account t…

778 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