Get-JobTrigger
예약된 작업의 작업 트리거를 가져옵니다.
구문
Get-JobTrigger
[[-TriggerId] <Int32[]>]
[-InputObject] <ScheduledJobDefinition>
[<CommonParameters>]
Get-JobTrigger
[[-TriggerId] <Int32[]>]
[-Name] <String>
[<CommonParameters>]
Get-JobTrigger
[[-TriggerId] <Int32[]>]
[-Id] <Int32>
[<CommonParameters>]
Description
Get-JobTrigger cmdlet은 예약된 작업의 작업 트리거를 가져옵니다. 이 명령을 사용하여 작업 트리거를 검사하거나 작업 트리거를 다른 cmdlet으로 파이프할 수 있습니다.
작업 트리거는 예약된 작업을 시작하기 위한 되풀이 일정 또는 조건을 정의합니다. 작업 트리거는 디스크에 독립적으로 저장되지 않습니다. 예약된 작업의 일부입니다. 작업 트리거를 얻으려면 트리거가 시작되는 예약된 작업을 지정합니다.
Get-JobTrigger cmdlet의 매개 변수를 사용하여 예약된 작업을 식별합니다.
예약된 작업을 이름이나 ID 번호로 식별하거나 Get-ScheduledJob cmdlet에서 반환된 개체와 같은 ScheduledJob 개체를 입력하거나 파이
Get-JobTrigger Windows PowerShell에 포함된 PSScheduledJob 모듈의 작업 예약 cmdlet 컬렉션 중 하나입니다.
예약된 작업에 대한 자세한 내용은 PSScheduledJob 모듈의 정보 항목을 참조하세요.
PSScheduledJob 모듈을 가져온 다음 Get-Help about_Scheduled*
입력하거나 about_Scheduled_Jobs 확인합니다.
이 cmdlet은 Windows PowerShell 3.0에서 도입되었습니다.
예제
예제 1: 예약된 작업 이름으로 작업 트리거 가져오기
PS C:\> Get-JobTrigger -Name "BackupJob"
이 명령은 Get-JobTriggerName 매개 변수를 사용하여 BackupJob 예약 작업의 작업 트리거를 가져옵니다.
예제 2: ID로 작업 트리거 가져오기
The first command uses the Get-ScheduledJob cmdlet to display the scheduled jobs on the local computer. The display includes the IDs of the scheduled jobs.
PS C:\> Get-ScheduledJob
Id Name Triggers Command Enabled
-- ---- -------- ------- -------
1 ArchiveProjects {1} \\Server\Share\Archive-Projects.ps1 True
2 Backup {1,2} \\Server\Share\Run-Backup.ps1 True
3 Test-HelpFiles {1} \\Server\Share\Test-HelpFiles.ps1 True
4 TestJob {} \\Server\Share\Run-AllTests.ps1 True
The second command uses the **Get-JobTrigger** cmdlet to get the job trigger for the Test-HelpFiles job (ID = 3)
PS C:\> Get-JobTrigger -ID 3
이 예제에서는 Get-JobTriggerID 매개 변수를 사용하여 예약된 작업의 작업 트리거를 가져옵니다.
예제 3: 작업을 파이핑하여 작업 트리거 가져오기
PS C:\> Get-ScheduledJob -Name *Backup*, *Archive* | Get-JobTrigger
이 명령은 이름에 Backup 또는 Archive가 있는 모든 작업의 작업 트리거를 가져옵니다.
예제 4: 원격 컴퓨터에서 작업의 작업 트리거 가져오기
PS C:\> Invoke-Command -ComputerName Server01 { Get-ScheduledJob Backup | Get-JobTrigger -TriggerID 2 }
이 명령은 원격 컴퓨터에서 예약된 작업의 두 작업 트리거 중 하나를 가져옵니다.
이 명령은 Invoke-Command cmdlet을 사용하여 Server01 컴퓨터에서 명령을 실행합니다. Get-ScheduledJob cmdlet을 사용하여 백업 예약된 작업을 가져옵니다. 이 작업은 Get-JobTrigger cmdlet으로 파이프됩니다. TriggerID 매개 변수를 사용하여 두 번째 트리거만 가져옵니다.
예제 5: 모든 작업 트리거 가져오기
PS C:\> Get-ScheduledJob | Get-JobTrigger | Format-Table -Property ID, Frequency, At, DaysOfWeek, Enabled, @{Label="ScheduledJob";Expression={$_.JobDefinition.Name}} -AutoSize
Id Frequency At DaysOfWeek Enabled ScheduledJob
-- --------- -- ---------- ------- ------------
1 Weekly 9/28/2011 3:00:00 AM {Monday} True Backup
1 Daily 9/27/2011 11:00:00 PM True Test-HelpFiles
이 명령은 로컬 컴퓨터에서 예약된 모든 작업의 모든 작업 트리거를 가져옵니다.
이 명령은 Get-ScheduledJob 사용하여 로컬 컴퓨터에서 예약된 작업을 가져오고 각 예약된 작업의 작업 트리거(있는 경우)를 가져오는 Get-JobTrigger
예약된 작업의 이름을 작업 트리거 표시에 추가하기 위해 명령은 Format-Table cmdlet의 계산된 속성 기능을 사용합니다. 기본적으로 표시되는 작업 트리거 속성 외에도 이 명령은 예약된 작업의 이름을 표시하는 새 ScheduledJob 속성을 만듭니다.
예제 6: 예약된 작업의 작업 트리거 속성 가져오기
The command uses the Get-ScheduledJob cmdlet to get the Test-HelpFiles scheduled job. Then it uses the dot method (.) to get the JobTriggers property of the Test-HelpFiles scheduled job.
PS C:\> (Get-ScheduledJob Test-HelpFiles).JobTriggers
The second command uses the Get-ScheduledJob cmdlet to get all scheduled jobs on the local computer. It uses the ForEach-Object cmdlet to get the value of the JobTrigger property of each scheduled job.
PS C:\> Get-ScheduledJob | foreach {$_.JobTriggers}
예약된 작업의 작업 트리거는 작업의 JobTriggers 속성에 저장됩니다. 이 예제에서는 Get-JobTrigger cmdlet을 사용하여 작업 트리거를 가져오는 대안을 보여 줍니다. 결과는 Get-JobTrigger cmdlet을 사용하는 것과 동일하며 기술을 서로 바꿔 사용할 수 있습니다.
예제 7: 작업 트리거 비교
The first command gets the job trigger of the ArchiveProjects scheduled job. The command pipes the job trigger to the Tee-Object cmdlet, which saves the job trigger in the $T1 variable and displays it at the command line.
PS C:\> Get-ScheduledJob -Name ArchiveProjects | Get-JobTrigger | Tee-Object -Variable T1
Id Frequency Time DaysOfWeek Enabled
-- --------- ---- ---------- -------
0 Daily 9/26/2011 3:00:00 AM True
The second command gets the job trigger of the Test-HelpFiles scheduled job. The command pipes the job trigger to the Tee-Object cmdlet, which saves the job trigger in the $T2 variable and displays it at the command line.
PS C:\> Get-ScheduledJob -Name "Test-HelpFiles" | Get-JobTrigger | Tee-Object -Variable T2
Id Frequency Time DaysOfWeek Enabled
-- --------- ---- ---------- -------
0 Daily 9/26/2011 3:00:00 AM True
The third command compares the job triggers in the $t1 and $t2 variables. It uses the Get-Member cmdlet to get the properties of the job trigger in the $t1 variable. It pipes the properties to the ForEach-Object cmdlet, which compares each property to the properties of the job trigger in the $t2 variable by name. The command then pipes the differing properties to the Format-List cmdlet, which displays them in a list.The output indicates that, although the job triggers appear to be the same, the HelpFiles job trigger includes a random delay of three (3) minutes.
PS C:\> $T1 | Get-Member -Type Property | ForEach-Object { Compare-Object $T1 $T2 -Property $_.Name}
RandomDelay SideIndicator
----------- -------------
00:00:00 =>
00:03:00 <=
이 예제에서는 예약된 두 작업의 작업 트리거를 비교하는 방법을 보여 줍니다.
매개 변수
-Id
예약된 작업의 ID 번호를 지정합니다. Get-JobTrigger 지정된 예약된 작업의 작업 트리거를 가져옵니다.
로컬 컴퓨터 또는 원격 컴퓨터에서 예약된 작업의 ID 번호를 얻으려면 Get-ScheduledJob cmdlet을 사용합니다.
형식: | Int32 |
Position: | 0 |
Default value: | None |
필수: | True |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
-InputObject
예약된 작업을 지정합니다.
형식: | ScheduledJobDefinition |
Position: | 0 |
Default value: | None |
필수: | True |
파이프라인 입력 허용: | True |
와일드카드 문자 허용: | False |
-Name
예약된 작업의 이름을 지정합니다. Get-JobTrigger 지정된 예약된 작업의 작업 트리거를 가져옵니다. 와일드카드가 지원됩니다.
로컬 컴퓨터 또는 원격 컴퓨터에서 예약된 작업의 이름을 얻으려면 Get-ScheduledJob cmdlet을 사용합니다.
형식: | String |
Position: | 0 |
Default value: | None |
필수: | True |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
-TriggerId
지정된 작업 트리거를 가져옵니다. 예약된 작업의 하나 이상의 작업 트리거에 대한 트리거 ID를 입력합니다. Name, ID또는 InputObject 매개 변수에 지정된 예약된 작업에 여러 작업 트리거가 있는 경우 이 매개 변수를 사용합니다.
형식: | Int32[] |
Position: | 1 |
Default value: | None |
필수: | False |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
입력
예약된 작업을 Get-ScheduledJob Get-JobTrigger
출력
관련 링크
- 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