Solved

Windows Server 2008 R2 - Scheduled Task - bat file

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
is there any Microsoft tool to see and collect event logs 3 51
Remote Desktop Session Host Configuration 2 82
FTP server backups 5 46
windows 2008 installation hangs 13 38
Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

730 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