Windows 7 scheduled task "runs" but doesn't DO anything

13,651

Got it! The problem was that I was referencing a mapped drive with P:\ both in the 'action' call and in the script itself. When I replaced all calls to the P drive with the full network path \server\share everything works fine. Of course mapped drives aren't available if I'm not logged in, makes perfect sense :p

Share:
13,651
Anonymous Man
Author by

Anonymous Man

A dog. On the internet.

Updated on June 04, 2022

Comments

  • Anonymous Man
    Anonymous Man almost 2 years

    I have a vbscript file that must run under 32bit on a 64 bit Windows 7 machine so that it can connect to a 32 bit Access database. From a run box I can enter:

    C:\Windows\SysWow64\WSCRIPT.EXE P:\Applicants\Applicants.wsf
    

    and it runs great. When I try to run this as a scheduled task, it runs in under a second (it shouldn't be that fast) and claims it finished successfully. This is the 'action' I am running it under currently:

    Start a Program
    C:\Windows\SysWow64\WSCRIPT.EXE
    Arguments: //Nologo //B P:\Applicants\Applicants.wsf >> P:\Applicants\logfile.txt
    

    I have also tried running it under CScript instead of WScript and the result is exactly the same.

    Before I added "//Nologo //B" (a tip I found here) it would start running and never stop.

    The optional "Start In" box is empty. If I put any value in it at all (tried P:\Applicants) the task fails to start with "Error Value: 2147942667." No solutions offered by searching this error code have worked so I leave this box empty.

    The logfile never even gets created and none of the work the script performs is getting done.

    The task runs under my network account and should have access to all needed drives and resources.

    Suggestions? Without a logfile I don't even know where to begin troubleshooting this thing.

    EDIT: New Info: If I set it to run only when I am logged in it works fine. It is only when set to run even if user is logged off that it doesn't work, even if I am logged in when it runs.

    EDIT 2: Security context of 'run even if user is logged off' states that ""...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."

    So I guess it thinks my script is somehow interactive, but it isn't. There aren't any kind of prompts or dialog boxes or msgBox calls so I'm not sure why this would be an issue.

  • Anonymous Man
    Anonymous Man about 11 years
    option 1 is worth a shot. I can't use option 2 because that would run it in the default 64bit and it wouldn't connect to the 32 bit Access database. Added some new info above as well.
  • kirbyfan64sos
    kirbyfan64sos about 11 years
    @AnonymousMan: Tell me how it goes. Also, read the link I provided. As for the 32/64 bit, oh, the aches and pains of 64-bit Windows!
  • Anonymous Man
    Anonymous Man about 11 years
    Result of running it from a batch file are the same. It will run only if 'run only if user is logged in' is selected. I need it to work when I'm logged out, but in a pinch I could stay logged in and locked if that counts as 'logged in'.
  • kirbyfan64sos
    kirbyfan64sos about 11 years
    @AnonymousMan: Your best bet is to lock the account as you stated. I'm assuming VBScript relies on things that are running only while the user is logged in. Sorry!
  • Anonymous Man
    Anonymous Man about 11 years
    Got it! The problem was that I was referencing a mapped drive with P:\ both in the 'action' call and in the script itself. When I replaced all calls to the P drive with the full network path \\server\share everything works fine. Of course mapped drives aren't available if I'm not logged in, makes perfect sense :p
  • kirbyfan64sos
    kirbyfan64sos about 11 years
    @AnonymousMan: If you want, to avoid keeping your account logged in, create another account with only the privilege to access that drive and keep that one logged in instead. Good luck!