Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schtasks Permission Error on Administrative User?

I know this has been asked in different ways a few times, but nothing has helped me for my specific case.

This is all done on a Windows 7 Home Premium desktop computer through Windows Command Line. I was attempting to create a simple batch program using schtasks to open a bunch of programs automatically upon my logon. However, when I attempt to create the task it says that the access is denied for my batch file.

    schtasks /create /tn Startup /tr "C:\ComputerStartup.bat" /sc onlogin
    ERROR: Access is denied.

So I tried to give my authentication (I am running this as an administrator user).

    schtasks /create /s Jackson-HP /u Jackson /sc onlogon /tn Startup /tr C:\ComputerStartup.bat

It prompted for a password for my user. I don't have a password for my computer so I just pressed enter, and it said:

    ERROR: User credentials are not allowed on the local machine.

I'm not sure how to fix this. I'm still new to creating batch files, so I may be making a newbie mistake. I appreciate any help you can give, thanks.

like image 769
Rezkin Avatar asked Feb 18 '13 01:02

Rezkin


People also ask

What is the use of the schtasks change command?

Reference article for the schtasks change command, which schedules commands and programs to run periodically or at a specific time, adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks. Describes how to use the at command to create and to cancel scheduled tasks.

What can I see when I run schtasks/query?

Running schtasks /query, it lists only the \ and Microsoft folders. If I run schtasks in an elevated shell, I can see all the folders and tasks. What properties of a task make it visible or not visible to a user? The two tasks in the Test folder were created by me the logged-in user, ie I am shown as the Author.

What permissions do I need to run a scheduled task?

Permissions for schtasks You must have permission to run the command. Any user can schedule a task on the local computer, and they can view and change the tasks that they scheduled. Members of the Administrators group can schedule, view, and change all tasks on the local computer.

What are the permissions of the specified user account?

Runs this command with the permissions of the specified user account. The default is the permissions of the current user of the local computer. The /u and /p parameters are valid only for scheduling a task on a remote computer (/s). The permissions of the specified account are used to schedule the task and to run the task.


2 Answers

Try using an elevated (admin) command prompt and use the /ru command-line switch instead of the /u one. Use /rp if you want to specify the password as well.

like image 151
gonzobrains Avatar answered Oct 22 '22 23:10

gonzobrains


I had this issue and solved it by recreating the scheduled task (via export and import). It seems that if the user running it is not the "author" of the task then it will throw the access denied error

like image 1
Sam Parslow Avatar answered Oct 22 '22 23:10

Sam Parslow