PowerShell Logo Small

Enable-ScheduledJob



This is the built-in help made by Microsoft for the command 'Enable-ScheduledJob', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Enables a scheduled job

SYNTAX


Enable-ScheduledJob [-InputObject] <ScheduledJobDefinition> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Enable-ScheduledJob [-Id] <Int32> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Enable-ScheduledJob [-Name] <String> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Enable-ScheduledJob cmdlet re-enables scheduled jobs that are disabled, such as those that are disabled by using the Disable-ScheduledJob cmdlet. Enabled jobs run
automatically when triggered.


To enable a scheduled job, the Enable-ScheduledJob cmdlet sets the Enabled property of the scheduled job to True ($true).


Enabled-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.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=290624
about_Scheduled_Jobs
Add-JobTrigger
Disable-JobTrigger
Disable-ScheduledJob
Enable-JobTrigger
Enable-ScheduledJob
Get-JobTrigger
Get-ScheduledJob
Get-ScheduledJobOption
New-JobTrigger
New-ScheduledJobOption
Register-ScheduledJob
Remove-JobTrigger
Set-JobTrigger
Set-ScheduledJob
Set-ScheduledJobOption
Unregister-ScheduledJob

REMARKS

<

Examples


Example 1: Enable a scheduled job

PS C:\>Enable-ScheduledJob -ID 2 -Passthru
Id Name Triggers Command Enabled
-- ---- -------- ------- -------
2 Inventory {1, 2} \\Srv01\Scripts\Get-FullInventory.ps1 True



This command enables the scheduled job with ID 2 on the local computer. The output shows the effect of the command.




Example 2: Enable all scheduled jobs

PS C:\>Get-ScheduledJob | Enable-ScheduledJob -Passthru
Id Name Triggers Command Enabled
-- ---- -------- ------- -------
1 ArchiveProje... {} C:\Scripts\Archive-DxProjects.ps1 True
2 Inventory {1, 2} \\Srv01\Scripts\Get-FullInventory.ps1 True
4 Test-HelpFiles {1} .\Test-HelpFiles.ps1 True
5 TestJob {1, 2} .\Run-AllTests.ps1 True



This command enables all scheduled jobs on the local computer. It uses the Get-ScheduledJob cmdlet to get all scheduled job and the Enable-ScheduledJob cmdlet to enable them.

Enable-ScheduledJob does not generate warnings or errors if you enable a scheduled job that is already enabled, so you can enable all scheduled jobs without conditions.




Example 3: Enable selected scheduled jobs

PS C:\>Get-ScheduledJob | Get-ScheduledJobOption | Where-Object {$_.RunWithoutNetwork} | ForEach-Object {Enable-ScheduledJob -InputObject $_.JobDefinition}



This command enables scheduled jobs that do not require a network connection.

The command uses the Get-ScheduledJob cmdlet to get all scheduled jobs on the computer. A pipeline operator sends the scheduled jobs to the Get-ScheduledJobOption cmdlet,
which gets the job options of each scheduled job. Each job options object has a JobDefinition property that contains the associated scheduled job. The JobDefinition property
is used to complete the command.

The command uses a pipeline operator (|) to send the job options to the Where-Object cmdlet, which selects scheduled job option objects in which the RunWithoutNetwork
property has a value of True ($true). Another pipeline operator sends the selected scheduled job options objects to the ForEach-Object cmdlet which runs an
Enable-ScheduledJob command on the scheduled job in the value of the JobDefinition property of each job options object.




Example 4: Enable scheduled jobs on a remote computer

PS C:\>Invoke-Command -ComputerName Srv01, Srv10 -ScriptBlock {Enable-ScheduledJob -Name Inventory}



This command enables scheduled jobs that have "test" in their names on two remote computers, Srv01 and Srv10.

The command uses the Invoke-Command cmdlet to run an Enable-ScheduledJob command on the Srv01 and Srv10 computers. The command uses the Name parameter of Enable-ScheduledJob
to enable the Inventory scheduled job on each computer.