?
Solved

Windows Server 2008 R2 - Scheduled Task - bat file

Posted on 2012-03-22
3
Medium Priority
?
3,904 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
[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
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
S00007359 earned 2000 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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
A safe way to clean winsxs folder from your windows server 2008 R2 editions
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
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…
Suggested Courses

765 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