Page 1 of 1

ERROR: User credentials are not allowed on the local machine

Posted: 15 Jul 2010 01:34
by Phail
What I want to do is to create a scheduled task that has a author different than the current user.

Running this:

schtasks /create /SC MINUTE /MO 5 /TN test /TR "c:\test\test.bat" /U system /f

Gives me: "ERROR: Invalid syntax. Cannot specify user name without specifying system name."

To fix this, I used the /s switch fallowed by system name. Sadly, even giving the system name gives me a different problem:

schtasks /create /SC MINUTE /MO 5 /TN test /TR "c:\test\test.bat" /s computername /U system /f

Gives me: "ERROR: User credentials are not allowed on the local machine"

Is there a way around this? I've tried the switch /RU fallowed by the user name, but that only changes the user the scheduled task use to run, not the author) Also, is there a variable for the system name? (So that I don't have to know it/ change it each time for each different computer) Something like [/s %currentsystem%]

Edit: Subject changed from "system name"

Re: ERROR: User credentials are not allowed on the local mac

Posted: 15 Jul 2010 02:24
by alan_b
Useful variables are
%USERDOMAIN%
%USERNAME%

If you run CMD.EXE and issue command
SET
that will list all the variables that have been defined

Alan

Re: ERROR: User credentials are not allowed on the local mac

Posted: 15 Jul 2010 03:51
by Phail
Thank you alan_b, that solved the variable trick :)

Now I just need to solve the other problem.

Re: ERROR: User credentials are not allowed on the local mac

Posted: 15 Jul 2010 05:50
by aGerman
Sounds like you have no rights to do this. Did you try to run as administrator? (type RUNAS /? to the command prompt)

Regards
aGerman