Solved

Windows Server 2008 R2 - Scheduled Task - bat file

Posted on 2012-03-22
3
3,575 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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

I was asked if I could set up a fax machine so that incoming faxes were delivered to people's Exchange inboxes and so that they could send faxes from their desktops without needing to print the document first.  I knew it was possible but I had no id…
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now