Solved

Windows Server 2008 R2 - Scheduled Task - bat file

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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

688 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