Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have some backup batch file scripts which I was running in xp and I have migrated to windoes server 2008 R2 where it's not running in front when scheduled with task manager. I struggled a lot to make it run at the scheduled time with task manager and it's running but not showing the process(running in the background). I also know the option to display all the running tasks. I searched in the google and I didn't find it so far. Does anyone know how to make task manager execute .bat file on the desktop(opening cmd prompt) in windows server 2008 R2?. I scheduled it to run as same desktop user!.

Thank you!

share|improve this question
    
If you know it's running, why do you need to see it? Doesn't that take away the point of automation? –  Nixphoe Jul 23 '11 at 11:07
    
@Nixpoe: As a everyday verification I need it else I'll have to dig to it's path everytime. –  user53864 Jul 23 '11 at 12:17

2 Answers 2

up vote 1 down vote accepted

Tasks can only launch interactively when you use the Run only when user is logged on option. Here's an excerpt from the Task Scheduler help file:

You can specify that a task should run even if the account under which the task is scheduled to run is not logged on when the task is triggered. To do this, select the radio button labeled Run whether user is logged on or not. If this radio button is selected, tasks will not run interactively. To make a task run interactively, select the Run only when user is logged on radio button.

I experimented a bit with psexec -i but no luck, sorry.

You can find a list of running scheduled tasks with schtasks.exe, eg:

schtasks /query | find "Running"

If you want to get a bit fancy, you could pull out the command line for each running task as well. Here's a batch file example:

@echo off
for /f "delims=," %%i in ('schtasks /query /fo csv ^| find "Running"') do (
    for /f "delims=, tokens=9" %%j in ('schtasks /query /fo csv /v /tn %%i ^| find /v "Next Run Time"') do (
        echo %%~i   %%j
    )
)
share|improve this answer
    
Logging-in to Administrator account, selecting Run only when user is logged on also with run with high privileges option and Specifying the desktop user under General tab, running the scripts on the desktop opening cmd at the scheduled time. As it's wroking I didn't try if it works with less options than what I'm using now. Thanks you! –  user53864 Jul 25 '11 at 13:00
    
Any more tips/tricks with new task scheduler are welcome! –  user53864 Jul 25 '11 at 13:02

In response to your comment above, there's 3 things you can do to verify your script was run correctly.

  1. You can check to make sure the scheduled task was successful.
  2. You can create a line at the end of your batch file to write a command to a file to show that it completed echo Script finished %date% %time% >> c:\batch\backupScript.log .
  3. You can run it manually.
share|improve this answer
    
Thank you for your interest. It helps a lot for verifying my backup. –  user53864 Jul 25 '11 at 13:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.