CmdID

CmdID / PowerShell / Cmdlets / Add

Add-JobTrigger

Adds job triggers to scheduled jobs. PowerShell reference

From the PowerShell reference 4 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Adds job triggers to scheduled jobs. The Add-JobTrigger cmdlet adds job triggers to scheduled jobs. You can use it to add multiple triggers to multiple scheduled jobs. A job trigger starts a scheduled job on a one-time or recurring schedule or when an event occurs. Use the Trigger parameter of Add-JobTrigger to identify the job triggers to add. Use the Name, Id, or InputObject parameters of Add-JobTrigger to identify the scheduled job to which the triggers are added. To create job triggers for the value of the Trigger parameter, use the New-JobTrigger cmdlet or use a hash table to specify the job trigger. Add-JobTrigger 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 was introduced in Windows PowerShell 3.0.

Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-InputObject] <ScheduledJobDefinition[]> [<CommonParameters>]
Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-Id] <Int32[]> [<CommonParameters>]
Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-Name] <String[]> [<CommonParameters>]

Add a job trigger to a scheduled job

$Daily = New-JobTrigger -Daily -At 3AMPS Add-JobTrigger -Trigger $Daily -Name "TestJob"Identify

Add a job trigger to several scheduled jobs

Get-ScheduledJob | Add-JobTrigger -Trigger (New-JobTrigger -AtStartup)Identify

Copy a job trigger

$T = Get-JobTrigger -Name "BackupArchives" Add-JobTrigger -Name "TestBackup,BackupLogs" -Trigger $TIdentify

Its page in the reference: Add-JobTrigger.

Parameters

4 in the PowerShell reference
-IdSpecifies the identification numbers of the scheduled jobs. Add-JobTrigger adds the job trigger to the specified scheduled jobs. To get the identification number of scheduled jobs on the local computer or a remote computer, use the Get-ScheduledJob cmdlet.
-InputObjectSpecifies the scheduled jobs. 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 Add-JobTrigger.
-NameSpecifies the names of the scheduled jobs. Add-JobTrigger adds the job triggers to the specified scheduled jobs. Wildcards are supported. To get the names of scheduled jobs on the local computer or a remote computer, use the Get-ScheduledJob cmdlet.
-TriggerSpecifies the job triggers to add. Enter a hash table that specifies job triggers or a variable that contains ScheduledJobTrigger objects, or type a command or expression that gets ScheduledJobTrigger objects, such as a Get-JobTrigger command. You can also pipe ScheduledJobTrigger objects to Add-JobTrigger.