Enable-ScheduledJob (PowerShell 3.0+)

Enable 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]

Key
   -Id Int32
       Enables the scheduled job with the specified identification number (ID).
       Enter the ID of a scheduled job.

   -InputObject ScheduledJobDefinition
       The scheduled job to be enabled.
       Enter a variable that contains ScheduledJobDefinition objects or type a
       command or expression that gets ScheduledJobDefinition objects, such as
       a Get-ScheduledJob command.
       You can also pipe a ScheduledJobDefinition object to Enable-ScheduledJob.

   -Name String
       Enables the scheduled jobs with the specified names.
       Enter the name of a scheduled job. Wildcards are supported.

   -PassThru
       Returns the scheduled jobs that were enabled.
       By default, this cmdlet does not generate any output.

   -Confirm
       Prompt for confirmation before running the cmdlet.

   -WhatIf
       Show what would happen if the cmdlet runs. The cmdlet is not run.

Enable-ScheduledJob cmdlet re-enables scheduled jobs that were disabled. 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).

Examples

Enable the scheduled job with ID 2 :

PS C:\> Enable-ScheduledJob -ID 2 -Passthru

Enable all scheduled jobs:

PS C:\> Get-ScheduledJob | Enable-ScheduledJob -Passthru

Enable all scheduled jobs on the computers listed in Servers.txt The command uses Invoke-Command to run a Enable-ScheduleJob command on each remote computer:

PS C:\> Invoke-Command -ComputerName (Get-Content Servers.txt) -ScriptBlock {Enable-ScheduledJob -Name Inventory}

“New York is an exciting town where something is happening all the time, most unsolved” ~ Johnny Carson

Related PowerShell Cmdlets

Scheduler cmdlets - Get/Set scheduled jobs.
Disable-ScheduledJob - Disable a scheduled job.
Get-ScheduledJob - Get scheduled jobs on the local computer.


 
Copyright © 1999-2024 SS64.com
Some rights reserved