Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am getting "ERROR: Network path was not found" when I try to create a scheduled task on my local machine. I am using this command at the command prompt: schtasks /tn taskname /tr taskpath /sc minute /mo 20 /sd 09/23/2010 /s \\%computername% /u username /p password

When I give the above command without computername, username and password the task gets created perfectly fine. What am I doing wrong??

EDIT : I got it working by using the below command. I do not understand why it is working becuase I am using /ru and /rp which are remote user and remote password settings whereas I am executing the command on my local machine. And I had to give double quotes to computername.

schtasks /tn taskname /tr taskpath /sc minute /mo 20 /sd 09/23/2010 /s "%computername%" /ru username /rp password
share|improve this question

3 Answers 3

up vote 0 down vote accepted

I believe if you are trying to run that command as written, the target machine %computername% will alway return your local machine name. By default schtasks works locally, unless you specify a remote machine with /s.

Now, if the command you are running is /s remotemachine, and you get that error, I believe the \\ is not necessary. Here are some examples.

Hope this helps.

share|improve this answer
    
I am running that command on my local machine only. I am not doing from remote computer. Although I am accessing the computer through remote access. my computer name has a hyphen "-" in it. Do you think becuase of hyphen I am getting this error? –  user50273 Sep 24 '10 at 14:06
    
Why I am saying about hyphen because, I ran the same command on another system and its working fine. –  user50273 Sep 24 '10 at 14:08
    
I guess the hyphen was escaped by the double quotes. The /ru & /rp are probably needed for the /s. If you are running the task on the local machine, you could probably get away with not using /s (and computer name) and change the /ru and /rp to /u and /p. I guess you need the task to run under alternate credentials and that is why you took the route you did. –  Scott McClenning Sep 24 '10 at 23:25

In the /tr taskpath argument, does the path contain any spaces? If so, surround the path with double quotes ". So instead of /tr c:\program files\test\run.exe you would use
/tr "c:\program files\test\run.exe".

share|improve this answer
    
the path where exe is located has no spaces. –  user50273 Sep 24 '10 at 14:07
    
Is there any way you could post the actual command you're using? –  boot13 Sep 24 '10 at 14:46
    
schtasks /create /tn MyApp /tr C:\Inetpub\wwwroot\WebApp\bin\MyApp.exe /sc minute /mo 20 /sd 09/24/2010 /s \\%computername% /u username /p password –  user50273 Sep 24 '10 at 14:53
    
I just got the schedule task created by using /ru and /rp settings instead of /u and /p. This command created the schedule task. I have no freaking idea why. "schtasks /create /tn MyApp /tr C:\Inetpub\wwwroot\WebApp\bin\MyApp.exe /sc minute /mo 20 /sd 09/24/2010 /ru username /rp password" –  user50273 Sep 24 '10 at 14:54

The /u and /r switches only apply to a remote system specified with /s and only used to gain permission to schedule a task on the remote system, and do not apply to what credentials the task runs with.

If you are accessing the computer through remote desktop (running schtasks.exe directly on the remote computer) you do not need /s /u /p; you already provided your credentials when you logged in via RDP. (It will fail if you provide them, because your already logged into that session.)

If you want to schedule a task on a remote system you are not logged into, that’s when you use the /s /u /p options. The /u and /p must have admin rights on /s to even schedule a task, otherwise it will fail.

If you specify /s without /u and /p, the it will use your current credentials, which may or may not be accepted by remote system /s (it fails if different domains, or domain ⇔ non-domain, etc.)

The /ru and /rp options are the credentials for the user that the actual task runs under when triggered (not the scheduling of the task) and stand for RunasUser and RunasPassword, not *Remote User* and Remote Password.

share|improve this answer

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.