Scheduled Task run permissions

I am trying to create a script at logon which creates a task that schedules a restart each evening.

I am able to get the task to schedule as well as run the command i am executing in the task. I am unable to get the task itself to run due to users not having any local admin rights. here is the script:

SCHTASKS /Delete /TN * /F

SCHTASKS /Create /SC DAILY /ST 23:59:00 /TN "Nightly Restart" /TR "Shutdown.exe /r /f /t 30" /RU DOMAIN\username /RP "password"

Any insight on being able to schedule the task and allow the users to run it will be very helpful thanks.
mnevosoAsked:
Who is Participating?
 
mnevosoAuthor Commented:
I resolved this issue by using Preferences in GPO.
0
 
PberSolutions ArchitectCommented:
Run the scheduled task under the system account.
 
SCHTASKS /Create /SC DAILY /ST 23:59:00 /TN "Nightly Restart" /TR "Shutdown.exe /r /f /t 30" /RU SYSTEM
0
 
mnevosoAuthor Commented:
i have tried this with the same result.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
PberSolutions ArchitectCommented:
I just pasted the SCHTASKS command above on my machine and ran it and it rebooted.
What is the exact problem?
0
 
mnevosoAuthor Commented:
the users in the domain do not have local admin rights or even power users rights to run the schedule task. that is the issue
0
 
PberSolutions ArchitectCommented:
Sorry I missed the part about it running from a logon script.  Yeah, you can't do that without admin rights.  However, if you are just trying to install a scheduled task that reboots the system every night you can do it remote using schtasks

SCHTASKS /Create /SC DAILY /ST 23:59:00 /TN "Nightly Restart" /TR "Shutdown.exe /r /f /t 30" /RU SYSTEM /S RemoteMachineName.
The /S flag will create the task on the system specified.  This could be scripted.
Alternately if you have a domain, you can opt to use a startup script in a group policy assigned to the OU that contains the computers.  The startup script runs under the system context and would be allowed to create the scheduled task.  You would only need to enable the GPO until all of your computers got the task installed, then you can remove the GPO.
 
 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.