Delete scheduled jobs on the local computer.
Syntax
Unregister-ScheduledJob [-InputObject] ScheduledJobDefinition[]
[-Force] [-Confirm] [-WhatIf] [CommonParameters]
Unregister-ScheduledJob [-Name] String[]
[-Force] [-Confirm] [-WhatIf] [CommonParameters]
Unregister-ScheduledJob [-Id] Int32[]
[-Force] [-Confirm] [-WhatIf] [CommonParameters]
Key
-Force
Delete the scheduled job even if an instance of the job is running.
By default, Unregister-ScheduledJob does not interrupt running jobs.
-Id Int32[]
Delete the scheduled jobs with the specified identification numbers (ID).
Enter the IDs of scheduled jobs on the computer.
-InputObject ScheduledJobDefinition[]
Specifies a scheduled job. Enter a variable that contains ScheduledJob objects or type a command or
expression that gets ScheduledJob objects, such as Get-ScheduledJob. You can also pipe ScheduledJob
objects to Unregister-JobTrigger.
-Name String[]
Delete the scheduled jobs with the specified names.
Enter the names of one or more scheduled jobs on the computer. Wildcards are supported.
-Confirm
Prompt for confirmation before running the cmdlet.
-WhatIf
Show what would happen if the cmdlet runs. The cmdlet is not run.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -PipelineVariable, -OutVariable.
When Unregister-ScheduledJob deletes or "unregisters" a scheduled job, it deletes the directory for the scheduled job ( $home\AppData\Local\Microsoft\Windows\PowerShell\ScheduledJobs), which contains the XML file that defines the scheduled job, the job execution history, and all job results. This action also deletes the job from Task Scheduler.
Unregister-ScheduledJob deletes only the scheduled jobs that are created by using Register-ScheduledJob . It does not delete scheduled jobs that are created in Task Scheduler.
Use the parameters of Unregister-ScheduledJob to delete scheduled jobs by ID or name, or pipe scheduled jobs from Get-ScheduledJob to Unregister-ScheduledJob.
Examples
Delete the scheduled job called SS64Job:
C:\PS> Unregister-ScheduledJob SS64Job
Delete all (PowerShell) scheduled jobs:
C:\PS> Get-ScheduledJob | Unregister-ScheduledJob -Force
Delete a scheduled job on a remote computer:
PS C:\> Invoke-Command -ComputerName Server64 { Unregister-ScheduledJob -Name SS64*}
“Every act of creation is first of all an act of destruction” ~ Pablo Picasso
Related PowerShell Cmdlets:
Scheduler cmdlets - Get/Set scheduled jobs.
Disable-ScheduledJob - Disable a scheduled job.
Get-ScheduledJob - Get scheduled jobs on the local computer.