locked
Task Manager in Server 2008 not running all the Batch files RRS feed

  • Question

  • I have a primary batch file that runs several nested batch files. All the nested batch files run except one. All the Batch files share the same rights to the folder, rights to run, and elevated prevlieges. i saw a similar posting on getting a batch file to schedule and did everything suggested to the single batch file that isn't running. No luck, the batch file builds it's log file with zero files edited. And yet when you run the batch file individually without it being assoicated to the nested batch file it runs perfectly.

    So I am baffled, this batch file just doesn't run using task manager. i still think it is something to do with elevated rights or rights in general but it is apparent I still do not have all the rights available for just this one batch.

    Any thoughts? Are there different rights assoicated with running a batch in the Powershell console as opposed to running within a task?

    Thursday, March 29, 2012 2:11 PM

All replies

  • Hello,


    It’s hard to provide you the accurate solution as we do not know how this task is configured and how the batch files are scripted. Here are some common suggestions.


    Try set the task to run whether or not someone is logged on.

    Check the checkbox Run with highest privileges/rights

    In Action window, you can see Start in (optional), fill in the full path of the folder where batch is located.

    In your batch files and in Task Scheduler, always use the full path like C:\foldername\batch.bat and if it’s networked path, use full UNC path name like \\192.168.1.1\sharefolder\batch.bat

    Use single quotation mark instead of double quotation mark in batch files.

    Try use the built-in Administrator account to run the batch. Permission problem is not what we can help.


    Thanks
    Zhang

    Friday, March 30, 2012 3:09 AM
  • This is the code that seems to be the problem:

    @pushd S:\Capstone\dataparc\RLK\rwf002
    @call rwf002_maptoq.bat RealTime testing testing
    @echo Start sync history files for RLK RWF002 at %date% %time% > RWF002HistorySync.log
    @echo Check archived files by dir command >> RWF002HistorySync.log
    @DIR /A:A Q:\Data\*.dat >> RWF002HistorySync.log
    @echo XCOPY Archived files.  >> RWF002HistorySync.log
    @XCOPY Q:\Data\*.dat History /M /Y >> RWF002HistorySync.log
    @echo finished sync history files for RLK RWF002 at %date% %time% >> RWF002HistorySync.log
    @if EXIST Q:\*.* net use q: /delete
    @POPD
    @PUSHD C:\PSScripts\
    @Powershell .\ZipSyncToyLogFile.ps1 C:\PSScripts 'S:\Capstone\dataparc\RLK\rwf002\RWF002HistorySync.log' S:\Capstone\dataparc\RLK\rwf002\Log RWF002History_SyncLog
    @POPD

    'rwf002_maptoq.bat'

    @if exist Q:\ net use Q: /delete @if %2.==. net use Q: \\rwf002\%1 @if not %2.==. net use Q: \\rwf002\%1 %2 /user:%3

    I have a bunch of files that all do exactly the same thing, all other work except the scripts above. When I run them in PowerShell Admin they work find, but when they are tasked they fail. I have done as was recommended and the files still fail.
    Friday, March 30, 2012 8:54 PM
  • Frankly speaking, there is no easy way to find out the root cause of a task scheduler problem. You will have to do more hunting and testing and that’s what we cannot help in Forum. You might want to post in PowerShell forum or Script Guy forum to check your script.


    Thanks
    Zhang

    Monday, April 2, 2012 9:11 AM