Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
409 changes: 222 additions & 187 deletions reference/3.0/PSScheduledJob/About/about_Scheduled_Jobs.md

Large diffs are not rendered by default.

298 changes: 153 additions & 145 deletions reference/3.0/PSScheduledJob/About/about_Scheduled_Jobs_Advanced.md

Large diffs are not rendered by default.

374 changes: 192 additions & 182 deletions reference/3.0/PSScheduledJob/About/about_Scheduled_Jobs_Basics.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

43 changes: 33 additions & 10 deletions reference/3.0/PSScheduledJob/Add-JobTrigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,35 @@ online version: http://go.microsoft.com/fwlink/?LinkID=223913
external help file: Microsoft.PowerShell.ScheduledJob.dll-Help.xml
title: Add-JobTrigger
---

# Add-JobTrigger

## SYNOPSIS

Adds job triggers to scheduled jobs

## SYNTAX

### JobDefinition (Default)

```
Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-InputObject] <ScheduledJobDefinition[]>
[<CommonParameters>]
```

### JobDefinitionId

```
Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-Id] <Int32[]> [<CommonParameters>]
```

### JobDefinitionName

```
Add-JobTrigger [-Trigger] <ScheduledJobTrigger[]> [-Name] <String[]> [<CommonParameters>]
```

## DESCRIPTION

The **Add-JobTrigger** cmdlet adds job triggers to scheduled jobs.
You can use it to add multiple triggers to multiple scheduled jobs.

Expand All @@ -46,11 +52,14 @@ For more information about Scheduled Jobs, see the About topics in the PSSchedul
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.

## EXAMPLES

### Example 1: Add a job trigger to a scheduled job
```
PS C:\> $Daily = New-JobTrigger -Daily -At 3AMPS C:\> Add-JobTrigger -Trigger $Daily -Name TestJob

```powershell
$Daily = New-JobTrigger -Daily -At 3AM
Add-JobTrigger -Trigger $Daily -Name TestJob
```

These commands add the Daily job trigger to the TestJob scheduled job.
Expand All @@ -59,20 +68,23 @@ The first command uses the New-JobTrigger cmdlet to create a job trigger that st
The command saves the job trigger in the $Daily variable.

The second command uses the **Add-JobTrigger** cmdlet to add the job trigger in the $Startup variable to the TestJob scheduled job.

### Example 2: Add a job trigger to many scheduled jobs
```
PS C:\> Get-ScheduledJob | Add-JobTrigger -Trigger (New-JobTrigger -AtStartup)

```powershell
Get-ScheduledJob | Add-JobTrigger -Trigger (New-JobTrigger -AtStartup)
```

This command adds an AtStartup job trigger to all scheduled jobs on the local computer.
It uses the Get-ScheduledJob to get all of the scheduled jobs on the computer.
It uses a pipeline operator (|) to send the jobs to the **Add-JobTrigger** cmdlet, which adds the job trigger to each of the scheduled jobs.
The value of the **Trigger** parameter is a New-JobTrigger command that creates the AtStartup job trigger.

### Example 3: Copy a job trigger
```
PS C:\> $t = Get-JobTrigger -Name BackupArchives

PS C:\> Add-JobTrigger -Name TestBackup, BackupLogs -Trigger $t
```powershell
$t = Get-JobTrigger -Name BackupArchives
Add-JobTrigger -Name TestBackup, BackupLogs -Trigger $t
```

These commands copy the job trigger from the BackupArchives scheduled job and add it to the TestBackup and BackupLogs scheduled jobs.
Expand All @@ -81,9 +93,11 @@ The first command uses the Get-JobTrigger cmdlet to get the job trigger of the B
The command saves the trigger in the $t variable.

The second command uses the **Add-JobTrigger** cmdlet to add the job trigger in $t to the TestBackup and BackupLogs scheduled jobs.

## PARAMETERS

### -Id

Specifies the identification numbers of the scheduled jobs.
**Add-JobTrigger** adds the job trigger to the specified scheduled jobs.

Expand All @@ -102,6 +116,7 @@ Accept wildcard characters: False
```

### -InputObject

Specifies 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**.
Expand All @@ -119,6 +134,7 @@ Accept wildcard characters: False
```

### -Name

Specifies the names of the scheduled jobs.
**Add-JobTrigger** adds the job triggers to the specified scheduled jobs.
Wildcards are supported.
Expand All @@ -138,6 +154,7 @@ Accept wildcard characters: True
```

### -Trigger

Specifies 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**.
Expand All @@ -155,15 +172,21 @@ Accept wildcard characters: False
```

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

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).

## INPUTS

### Microsoft.PowerShell.ScheduledJob.ScheduledJobTrigger, Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition

You can pipe job triggers or scheduled jobs to **Add-JobTrigger**.

## OUTPUTS

### None

This cmdlet does not return any output.

## NOTES

## RELATED LINKS
Expand Down Expand Up @@ -200,4 +223,4 @@ This cmdlet does not return any output.

[Set-ScheduledJobOption](Set-ScheduledJobOption.md)

[Unregister-ScheduledJob](Unregister-ScheduledJob.md)
[Unregister-ScheduledJob](Unregister-ScheduledJob.md)
52 changes: 40 additions & 12 deletions reference/3.0/PSScheduledJob/Disable-JobTrigger.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
Expand All @@ -7,17 +7,20 @@ online version: http://go.microsoft.com/fwlink/?LinkID=223918
external help file: Microsoft.PowerShell.ScheduledJob.dll-Help.xml
title: Disable-JobTrigger
---

# Disable-JobTrigger

## SYNOPSIS

Disables the job triggers of scheduled jobs

## SYNTAX

```
Disable-JobTrigger [-InputObject] <ScheduledJobTrigger[]> [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

The **Disable-JobTrigger** cmdlet temporarily disables the job triggers of scheduled jobs.
Disabling preserves all job trigger properties, but it prevents the job trigger from starting the scheduled job.

Expand All @@ -36,24 +39,31 @@ For more information about Scheduled Jobs, see the About topics in the PSSchedul
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.

## EXAMPLES

### Example 1: Disable a job trigger
```
PS C:\> Get-JobTrigger -Name Backup-Archives -TriggerID 1 | Disable-JobTrigger

```powershell
Get-JobTrigger -Name Backup-Archives -TriggerId 1 | Disable-JobTrigger
```

This command disables the first trigger (ID=1) of the Backup-Archives scheduled job on the local computer.

The command uses the Get-JobTrigger cmdlet to get the job trigger.
A pipeline operator sends the job trigger to the **Disable-JobTrigger** cmdlet, which disables it.

### Example 2: Disable all job triggers

```powershell
Get-ScheduledJob -Name Backup-Archives, Inventory | Get-JobTrigger | Disable-JobTrigger
```
The first command uses the Get-ScheduledJob cmdlet to get the Backup-Archives and Inventory scheduled jobs. A pipeline operator (|) sends the scheduled jobs to the Get-JobTrigger cmdlet, which gets all job triggers of the scheduled jobs. Another pipeline operator sends the job triggers to the **Disable-JobTrigger** cmdlet, which disables them.The first command uses the **Get-ScheduledJob** cmdlet to get the jobs, because its **Name** parameter takes multiple names.
PS C:\> Get-ScheduledJob -Name Backup-Archives, Inventory | Get-JobTrigger | Disable-JobTrigger

The second command displays the results. The command repeats the **Get-ScheduledJob** and **Get-JobTrigger** command. A pipeline operator sends the job triggers to the Format-Table cmdlet, which displays the job triggers in a table. The **Format-Table** command adds a **JobName** property that displays the value of the **Name** property of the scheduled job in the **JobDefinition** property of the job trigger object.
PS C:\> Get-ScheduledJob -Name Backup-Archives, Inventory | Get-JobTrigger | Format-Table -Property ID, Frequency, At, DaysOfWeek, Enabled, @{Label="JobName";Expression={$_.JobDefinition.Name}} -AutoSize
```powershell
Get-ScheduledJob -Name Backup-Archives, Inventory | Get-JobTrigger | Format-Table -Property ID, Frequency, At, DaysOfWeek, Enabled, @{Label="JobName";Expression={$_.JobDefinition.Name}} -AutoSize
```

```output
Id Frequency At DaysOfWeek Enabled JobName
-- --------- -- ---------- ------- -------
1 Weekly 9/28/2011 3:00:00 AM {Monday} False Backup-Archive
Expand All @@ -63,9 +73,15 @@ Id Frequency At DaysOfWeek Enabled JobName
```

These commands disable all job triggers on two scheduled jobs and display the results.

The first command uses the Get-ScheduledJob cmdlet to get the Backup-Archives and Inventory scheduled jobs. A pipeline operator (|) sends the scheduled jobs to the Get-JobTrigger cmdlet, which gets all job triggers of the scheduled jobs. Another pipeline operator sends the job triggers to the **Disable-JobTrigger** cmdlet, which disables them.The first command uses the **Get-ScheduledJob** cmdlet to get the jobs, because its **Name** parameter takes multiple names.

The second command displays the results. The command repeats the **Get-ScheduledJob** and **Get-JobTrigger** command. A pipeline operator sends the job triggers to the Format-Table cmdlet, which displays the job triggers in a table. The **Format-Table** command adds a **JobName** property that displays the value of the **Name** property of the scheduled job in the **JobDefinition** property of the job trigger object.

### Example 3: Disable job trigger of a scheduled job on a remote computer.
```
PS C:\> Invoke-Command -ComputerName Server01 {Get-JobTrigger -Name DeployPackage | Where-Object {$_.Frequency -eq "Daily"} | Disable-JobTrigger}

```powershell
Invoke-Command -ComputerName Server01 {Get-JobTrigger -Name DeployPackage | Where-Object {$_.Frequency -eq "Daily"} | Disable-JobTrigger}
```

This command disables the daily job triggers on the DeployPackage scheduled job on the Server01 remote computer.
Expand All @@ -74,9 +90,11 @@ The command uses the Invoke-Command cmdlet to run the commands on the Server01 c
The remote command uses the Get-JobTrigger cmdlet to get the job triggers of the DeployPackage scheduled job.
A pipeline operator sends the job triggers to the Where-Object cmdlet which returns only daily job triggers.
A pipeline operator sends the daily job triggers to the **Disable-JobTrigger** cmdlets which disables them.

## PARAMETERS

### -InputObject

Specifies the job trigger to be disabled.
Enter a variable that contains **ScheduledJobTrigger** objects or type a command or expression that gets **ScheduledJobTriger** objects, such as a Get-JobTrigger command.
You can also pipe a **ScheduledJobTrigger** object to **Disable-JobTrigger**.
Expand All @@ -94,6 +112,7 @@ Accept wildcard characters: False
```

### -Confirm

Prompts you for confirmation before running the cmdlet.

```yaml
Expand All @@ -109,6 +128,7 @@ Accept wildcard characters: False
```

### -WhatIf

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

Expand All @@ -125,17 +145,25 @@ Accept wildcard characters: False
```

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

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

## INPUTS

### Microsoft.PowerShell.ScheduledJob.ScheduledJobTrigger

You can pipe job triggers to **Disable-JobTrigger**.

## OUTPUTS

### None

This cmdlet does not generate any output.

## NOTES
* **Disable-JobTrigger** does not generate errors or warnings if you disable a job trigger that is already disabled.

- **Disable-JobTrigger** does not generate errors or warnings if you disable a job trigger that is already disabled.

## RELATED LINKS

[about_Scheduled_Jobs](About/about_Scheduled_Jobs.md)
Expand Down
Loading