Get-ScheduledJobOption (PowerShell 3.0+)

Get the job options of scheduled jobs.

Syntax
      Get-ScheduledJobOption [-InputObject] ScheduledJobDefinition [CommonParameters]

      Get-ScheduledJobOption [-Id] Int32 [CommonParameters]

      Get-ScheduledJobOption [-Name] String [CommonParameters]

Key
   -Id Int32
        The identification number of a scheduled job. Get the job options of the specified job.
        The identification numbers are returned by Get-ScheduledJob.

    -InputObject ScheduledJobDefinition
        Specify a scheduled job.
        Enter a variable, or pipe an object that contains a ScheduledJob object (or type a command
        or expression that gets a ScheduledJob object, such as Get-ScheduledJob.)

    -Name String
        The names of scheduled jobs. Get the job options of the specified scheduled job.
        Wildcards are supported.

Use this command to examine the job options or to pipe the job options to other cmdlets.

Job options are not saved to disk independently; they are part of a scheduled job. To get the job options of a scheduled job, specify the scheduled job.

Use the parameters of the Get-ScheduledJobOption cmdlet to identify the scheduled job. You can identify scheduled jobs by their names or identification numbers, or by entering or piping ScheduledJob objects, such as the those that are returned by Get-ScheduledJob

The scheduled job options determine how the job runs when it is started by Task Scheduler.
These options do not apply when you use Start-Job to start a scheduled job.

Examples

Get the job options of scheduled jobs that have "BackUp" in their names:

PS C:\> Get-ScheduledJobOption -Name *Backup*

Get all job options of all scheduled jobs on the local computer:

PS C:\> Get-ScheduledJob | Get-ScheduledJobOptions

Find specific job options:

PS C:\> Get-ScheduledJob | Get-ScheduledJobOption | Where {$_.RunElevated -and !$_.WaketoRun}

Display the job definitions for those jobs:

PS C:\> Get-ScheduledJob | Get-ScheduledJobOption | Where {$_.RunElevated -and !$_.WaketoRun} | ForEach-Object {$_.JobDefinition}

“You were born to win, but to be a winner, you must plan to win, prepare to win, and expect to win” ~ Zig Ziglar

Related PowerShell Cmdlets

Scheduler cmdlets - Get/Set scheduled jobs.
Set-ScheduledJobOption - Change the options of a scheduled job.


 
Copyright © 1999-2024 SS64.com
Some rights reserved