Delete windows scheduled tasks
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I made a basic task with Task Scheduler
My account is part of the domain admins group
I cannot delete the task I made with my own user acount
If open Task Scheduler with Run As Administrator, I still cannot delete the task.
I can only delete the task by running the command prompt as administrator with the schtasks /delete command.
I cannot delete the task with the schtasks /delete command if I run the command prompt as myself
Why can’t I delete my own task? Why can’t user administrator delete the task with the Task Scheduler MMC?
Answers
Can you run procmon to anlayze the access granted between your account vs administrator account ?
You are able to delete the task using command prompt but not the MMC using administrator account which means the Task scheduler component works appropriately , this you can analyze by
a) restarting the task scheduler service, if the service starts without any problem then OS is using Local system account to authenticate the priviliges.
b) Try restarting the dependency services ( RPC ) and also check for RPC errors if any
Are you seeing any error in event log?
All replies
Thank you for posting here.
What’s the server operation system? If you logon another domain admin account, can you delete this task?
Please start the command prompt with «Run as Administrator» option to run schtasks /delete command. Does it work?
This posting is provided «AS IS» with no warranties, and confers no rights. Please click «Mark as Answer» when you get the correct reply to your question.
Can you delete them from?
Regards, Dave Patrick . Microsoft Certified Professional -Microsoft MVP [Windows]
The Operating system is Server 2008, not R2.
I cannot delete the task if I run the task scheduler as user Administrator
I can delete the task with the schtasks /delete command, only if I run the command prompt as user Administrator.
I was able to delete the Task form the c:\windows\system32\Tasks folder.
That does not really resolve the problem though. Why can’t I delete the Task with Task Scheduler. The technet article for Server 2008 says it’s as simple as clicking the delete button.
Yes, it was just a test. Does deleting from the Task Scheduler MMC generate any errors?
Regards, Dave Patrick . Microsoft Certified Professional -Microsoft MVP [Windows]
Can you run procmon to anlayze the access granted between your account vs administrator account ?
You are able to delete the task using command prompt but not the MMC using administrator account which means the Task scheduler component works appropriately , this you can analyze by
a) restarting the task scheduler service, if the service starts without any problem then OS is using Local system account to authenticate the priviliges.
b) Try restarting the dependency services ( RPC ) and also check for RPC errors if any
Are you seeing any error in event log?
Did you had a chance to perform the action plan suggested earlier ?
ABeach, please try this:
Delete the offending file from C:\Windows\Tasks
After the file is deleted, if it is still showing on the scheduled task menu. Just sort the menu by task using the Settings—>ControlPanel—>Schedule Tasks—>Add Schedule Task —> right click Sort By Name menu item.
I know this sounds crazy — but your task will disappear after being sorted if there is no corresponding task file in the C:\Windows\Tasks folder.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful. Michael Mayo
Did you find an answer to this? I have the same problem. Also when I deleted the task from C:\windows\System32\tasks as some suggested as a solution, it actually crashed the task scheduler completely. You can not restart the task scheduler from services.msc and you are stuck rebooting the server. I’m not sure rebooting the server is going to fix it but I assume yes.
So DO NOT FOLLOW the advice of deleting the task at the file level! That much I can tell you is INCORRECT!
Also, run as administrator makes no difference.
You are a domain administrator.
You most likely created the task before you promoted the computer to be part of the domain and thus with the local administrator account (once promoted, the local is dormant, but not removed!). I usually delete the local admin account for security reasons. But if you haven’t then you can login as local admin and remove the scheduled tasks.
You delete the task from the command prompt as «domain\administrator»
schtasks /delete /tn nameoftask
I consider this a bug in MS promoting to DC as every remainder of the local admin should be verified by the promotion mechanism prior to the actual promoting and thus tell the user to either remove everything from the local administrator account or take it over by the domain administrator. Note you don’t always see if you’re working local admin or domain admin. You CAN always see it but it’s not always obvious as on many occasions windows just tells you:»administrator» instead of «local\administrator» or «domain\administrator» but they are 2 different users.
команды SchTasks schtasks commands
Планирует выполнение команд и программ периодически или в определенное время, добавляет и удаляет задачи из расписания, запускает и останавливает задачи по требованию, а также отображает и изменяет запланированные задачи. 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.
Средство schtasks.exe выполняет те же операции, что и запланированные задачи на панели управления. The schtasks.exe tool performs the same operations as Scheduled Tasks in Control Panel. Эти инструменты можно использовать совместно и взаимозаменяемы. You can use these tools together and interchangeably.
Необходимые разрешения Required permissions
Чтобы запланировать, просмотреть и изменить все задачи на локальном компьютере, необходимо быть членом группы «Администраторы». To schedule, view, and change all tasks on the local computer, you must be a member of the Administrators group.
Чтобы запланировать, просмотреть и изменить все задачи на удаленном компьютере, необходимо быть членом группы «Администраторы» на удаленном компьютере или использовать параметр /u для предоставления учетных данных администратора удаленного компьютера. To schedule, view, and change all tasks on the remote computer, you must be a member of the Administrators group on the remote computer, or you must use the /u parameter to provide the credentials of an Administrator of the remote computer.
Параметр /u в операции /CREATE или /Change можно использовать, если локальный и удаленный компьютеры находятся в одном домене или если локальный компьютер находится в домене, которому доверяет домен удаленного компьютера. You can use the /u parameter in a /create or /change operation if the local and remote computers are in the same domain, or if the local computer is in a domain that the remote computer domain trusts. В противном случае удаленный компьютер не может проверить подлинность указанной учетной записи пользователя и не сможет проверить, является ли эта учетная запись членом группы «Администраторы». Otherwise, the remote computer can’t authenticate the user account specified, and it can’t verify that the account is a member of the Administrators group.
Задача, которую планируется запустить, должна иметь соответствующее разрешение; Эти разрешения зависят от задачи. The task you plan to run must have the appropriate permission; these permissions vary by task. По умолчанию задачи выполняются с разрешениями текущего пользователя локального компьютера или с разрешениями пользователя, заданного параметром /u , если он включен. By default, tasks run with the permissions of the current user of the local computer, or with the permissions of the user specified by the /u parameter, if one is included. o запустите задачу с разрешениями другой учетной записи пользователя или с системными разрешениями, используя параметр /ru . o run a task with permissions of a different user account or with system permissions, use the /ru parameter.
How to use PowerShell to Delete or Create a Scheduled Task on Windows 10
If you want to delete or create a scheduled task on Windows 10 using Windows PowerShell, this tutorial will help you do that. You do not have to open Task Scheduler to create the scheduled task. However, you have to execute some commands to get the job done.
Task Scheduler is one of the best utilities of Windows 10, allows you to create tasks and perform them at a scheduled time. From open an app like Notepad to executing PowerShell scripts, you can do everything with Task Scheduler’s help.
Create a scheduled task with PowerShell
To use PowerShell to create a scheduled task on Windows 10, follow these steps-
- Search for powershell in the Taskbar search box.
- Click on Run as administrator.
- Click the Yes button.
- Enter the $action variable to store the action.
- Enter the $trigger variable to store the timings of the scheduled task.
- Enter this command to create the scheduled task.
Let’s check out the detailed version of these steps.
At first, you have to open Windows PowerShell with administrator privileges. For that, search for “powershell” in the Taskbar search box, and click on the respective Run as administrator button. If the UAC prompt appears, click the Yes button. Once the PowerShell screen is visible, enter the following command-
Do not forget to replace the app-path with the original path of the app you want to run.
For example, if you want to open Notepad, enter notepad.exe. If you want to open Google Chrome on a 64-bit Windows 10 computer, enter the following path-
The entire command will look like this-
In case you want to execute a PowerShell script, you have to use -argument and specify the script. In that case, the command will look like this-
Next, you have to set the time when you want to execute the task. Like Task Scheduler, you can choose any time according to your requirements. The basic command looks like this-
As per this command, the task will run once at 06:30 PM or 18:30 on the same day. It is possible to use various settings like -Daily, -Weekly, -Monthly, etc. On the other hand, you can choose the time in 12 or 24-hour format. If you choose a 12-hour format, you must define the AM/PM.
After that, you have to register for the task. For that, enter the following command-
Do not forget to change the DemoName, DemoTask, and DemoDescription according to your preference.
Once done, you will be greeted with the following screen-
Delete a scheduled task with PowerShell
To use PowerShell to delete scheduled tasks, follow these steps-
- Search for powershell in the Taskbar search box.
- Click on Run as administrator.
- Click the Yes button.
- Enter the following command to select the task.
- Enter the Unregister command to delete the task.
To learn more about these steps, keep reading.
At first, open an elevated Windows PowerShell window and enter the following command-
Don’t forget to replace the DemoTask with the original task name. after that, enter this command to delete the task-
To confirm the removal, you can enter the first command. If it shows an error message, the task is removed.