To delete a scheduled task with PowerShell, run Unregister-ScheduledTask with the task’s name and folder, and add -Confirm:$false so it doesn’t stop to ask:
Unregister-ScheduledTask -TaskName 'Weekly Backup Check' -TaskPath '\PSFAQsDemo\' -Confirm:$false
Here’s the situation I usually face. An old server has a pile of tasks from scripts nobody runs anymore, and I need to remove a handful of them without touching the hundreds Windows ships with.
In this tutorial, I’ll show you how to delete a scheduled task in PowerShell safely: one task, a folder of tasks, the empty folder itself, a task that doesn’t exist, schtasks and remote computers.
I tested everything on Windows 11 in PowerShell 7.6 and Windows PowerShell 5.1, on throwaway tasks in a PSFAQsDemo folder. My account isn’t an administrator, and it could still delete tasks it created.
Delete one scheduled task with Unregister-ScheduledTask
Always check the exact name and folder first. The post on how to list scheduled tasks with PowerShell shows the filters I use. Then delete it:
$path = '\PSFAQsDemo\'
'Before: ' + ((Get-ScheduledTask -TaskPath $path | Sort-Object TaskName).TaskName -join ', ')
Unregister-ScheduledTask -TaskName 'Weekly Backup Check' -TaskPath $path -Confirm:$false
'After: ' + ((Get-ScheduledTask -TaskPath $path | Sort-Object TaskName).TaskName -join ', ')
Output:
Before: Daily Sales Report, Temp Cleanup - Austin, Temp Cleanup - Denver, Weekly Backup Check
After: Daily Sales Report, Temp Cleanup - Austin, Temp Cleanup - Denver

Unregister-ScheduledTask prints nothing when it works, so the before and after lines are your proof. Windows PowerShell 5.1 printed the same two lines.
What happens without -Confirm:$false?
The cmdlet’s ConfirmImpact is High, so it always asks first. This is the same command without the switch; I typed Y:

That’s handy at the console and fatal in a script. In a scheduled or -NonInteractive session there’s nobody to answer, and the command fails with “PowerShell is in NonInteractive mode”. The prompt was identical in 5.1.
Why -TaskPath matters for tasks in folders
Microsoft Learn says a missing -TaskPath means the root folder. That’s not what I saw. I had a Daily Sales Report task in PSFAQsDemo and another one in PSFAQsDemo\Archive, and -WhatIf showed which ones would go:
'Without -TaskPath:'
Unregister-ScheduledTask -TaskName 'Daily Sales Report' -WhatIf
'With -TaskPath:'
Unregister-ScheduledTa