Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Unregister-ScheduledJob

Updated: October 17, 2013

Applies To: Windows PowerShell 4.0

Unregister-ScheduledJob

Deletes scheduled jobs on the local computer.

Syntax

Parameter Set: Definition
Unregister-ScheduledJob [-InputObject] <ScheduledJobDefinition[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: DefinitionId
Unregister-ScheduledJob [-Id] <Int32[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: DefinitionName
Unregister-ScheduledJob [-Name] <String[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Unregister-ScheduledJob cmdlet deletes scheduled jobs from the local computer.

When it deletes or "unregisters" a scheduled job, Unregister-ScheduledJob deletes the directory for the scheduled job (in the $home\AppData\Local\Microsoft\Windows\PowerShell\ScheduledJobs directory), 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 the Register-ScheduledJob cmdlet. It does not delete scheduled jobs that are created in Task Scheduler.

You can use the parameters of Unregister-ScheduledJob to delete scheduled jobs by ID or name, or pipe scheduled jobs from Get-ScheduledJob to Unregister-ScheduledJob.

Unregister-ScheduledJob is one of a collection of job scheduling cmdlets in the PSScheduledJob module that is included in Windows PowerShell.

For more information about Scheduled Jobs, see the About topics in the PSScheduledJob module. Import the PSScheduledJob module and then type: Get-Help about_Scheduled* or see about_Scheduled_Jobs.

This cmdlet is introduced in Windows PowerShell 3.0.

Parameters

-Force

Deletes the scheduled job even if an instance of the job is running. By default, Unregister-ScheduledJob does not interrupt running jobs.


Aliases

none

Required?

false

Position?

named

Default Value

False

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Id<Int32[]>

Deletes the scheduled jobs with the specified identification numbers (ID). Enter the IDs of scheduled jobs on the computer.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-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 a Get-ScheduledJob command. You can also pipe ScheduledJob objects to Unregister-JobTrigger.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Name<String[]>

Deletes the scheduled jobs with the specified names. Enter the names of one or more scheduled jobs on the computer. Wildcards are supported.


Aliases

none

Required?

true

Position?

1

Default Value

None

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition

    You can pipe scheduled jobs to Unregister-ScheduledJob


Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

    This cmdlet does not generate any output.


Examples

Example 1: Delete a scheduled job

This command deletes the TestJob scheduled job on the local computer.


PS C:\> Unregister-ScheduledJob TestJob

Example 2: Delete all scheduled jobs

This examples shows two different commands that delete all scheduled jobs on the local computer.

The first command uses the Get-ScheduledJob cmdlet to get all scheduled jobs on the local computer. A pipeline operator (|) sends the scheduled jobs to Unregister-ScheduleJob, which deletes them.

The second command uses the Name parameter of Unregister-ScheduledJob with a value of all (*) to delete all scheduled jobs.

Both commands use the Force parameter, which deletes a scheduled job even if an instance of the job is running.


PS C:\> Get-ScheduledJob | Unregister-ScheduledJob -Force
 
                      
PS C:\>Unregistered-ScheduledJob -Name * -Force

Example 3: Delete a scheduled job on a remote computer

This command deletes scheduled jobs with names that begin with "Test" on the Server01 remote computer. The command uses the Invoke-Command cmdlet to run the Unregister-ScheduledJob command on the Server02 computer.


PS C:\> Invoke-Command -ComputerName Server01 { Unregister-ScheduledJob -Name Test*}

Related topics



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.