Get-ScheduledJobOption
예약된 작업의 작업 옵션을 가져옵니다.
구문
Get-ScheduledJobOption
[-InputObject] <ScheduledJobDefinition>
[<CommonParameters>]
Get-ScheduledJobOption
[-Id] <Int32>
[<CommonParameters>]
Get-ScheduledJobOption
[-Name] <String>
[<CommonParameters>]
Description
Get-ScheduledJobOption cmdlet은 예약된 작업의 작업 옵션을 가져옵니다. 이 명령을 사용하여 작업 옵션을 검사하거나 작업 옵션을 다른 cmdlet으로 파이프할 수 있습니다.
작업 옵션은 디스크에 독립적으로 저장되지 않습니다. 예약된 작업의 일부입니다. 예약된 작업의 작업 옵션을 얻으려면 예약된 작업을 지정합니다.
get-ScheduledJobOption cmdlet
Get-ScheduledJobOption Windows PowerShell에 포함된 PSScheduledJob 모듈의 작업 예약 cmdlet 컬렉션 중 하나입니다.
예약된 작업에 대한 자세한 내용은 PSScheduledJob 모듈의 정보 항목을 참조하세요.
PSScheduledJob 모듈을 가져온 다음 Get-Help about_Scheduled*
입력하거나 about_Scheduled_Jobs 확인합니다.
이 cmdlet은 Windows PowerShell 3.0에서 도입되었습니다.
예제
예제 1: 작업 옵션 가져오기
PS C:\> Get-ScheduledJobOption -Name "*Backup*"
StartIfOnBatteries : False
StopIfGoingOnBatteries : True
WakeToRun : False
StartIfNotIdle : True
StopIfGoingOffIdle : False
RestartOnIdleResume : False
IdleDuration : 00:10:00
IdleTimeout : 01:00:00
ShowInTaskScheduler : True
RunElevated : True
RunWithoutNetwork : True
DoNotAllowDemandStart : False
MultipleInstancePolicy : Ignore
NewJobDefinition : Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition
이 명령은 이름에 BackUp이 있는 예약된 작업의 작업 옵션을 가져옵니다.
결과에는 Get-ScheduledJobOption 반환된
예제 2: 모든 작업 옵션 가져오기
PS C:\> Get-ScheduledJob | Get-ScheduledJobOptions
이 명령은 로컬 컴퓨터에서 예약된 모든 작업의 작업 옵션을 가져옵니다.
Get-ScheduledJob cmdlet을 사용하여 로컬 컴퓨터에서 예약된 작업을 가져옵니다. 파이프라인 연산자(|)는 예약된 작업을 각 예약된 작업의 작업 옵션을 가져오는 Get-ScheduledJobOptions cmdlet으로 보냅니다.
예제 3: 선택한 작업 옵션 가져오기
PS C:\> Get-ScheduledJob | Get-ScheduledJobOption | Where {$_.RunElevated -and !$_.WaketoRun}
StartIfOnBatteries : False
StopIfGoingOnBatteries : True
WakeToRun : True
StartIfNotIdle : True
StopIfGoingOffIdle : False
RestartOnIdleResume : False
IdleDuration : 00:10:00
IdleTimeout : 01:00:00
ShowInTaskScheduler : True
RunElevated : True
RunWithoutNetwork : True
DoNotAllowDemandStart : False
MultipleInstancePolicy : Ignore
NewJobDefinition : Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition
The second command shows how to find to which scheduled job the job options belong. This command uses a pipeline operator (|) to send the selected job options to the ForEach-Object cmdlet, which gets the JobDefinition property of each options object. The JobDefinition property contains the originating job object. The results show that the selected options came from the DeployPkg scheduled job.
PS C:\> Get-ScheduledJob | Get-ScheduledJobOption | Where {$_.RunElevated -and !$_.WaketoRun} | ForEach-Object {$_.JobDefinition}
Id Name Triggers Command Enabled
-- ---- -------- ------- -------
2 DeployPkg {1, 2} DeployPackage.ps1 True
이 예제에서는 특정 값을 가진 작업 옵션 개체를 찾는 방법을 보여줍니다.
첫 번째 명령은 RunElevated 속성의 값이 $True RunWithoutNetwork 속성의 값이 $False 작업 옵션을 가져옵니다. 출력은 선택한 JobOptions 개체를 보여 줍니다.
예제 4: 작업 옵션을 사용하여 새 작업 만들기
PS C:\> $Opts = Get-ScheduledJobOption -Name "BackupTestLogs"
PS C:\> Register-ScheduledJob -Name "Archive-Scripts" -FilePath "\\Srv01\Scripts\ArchiveScripts.ps1" -ScheduledJobOption $Opts
이 예제에서는 Get-ScheduledJobOptions 새 예약된 작업에서 가져오는 작업 옵션을 사용하는 방법을 보여줍니다.
첫 번째 명령은 Get-ScheduledJobOptions 사용하여 BackupTestLogs 예약된 작업의 작업 옵션을 가져옵니다. 이 명령은 $Opts 변수에 옵션을 저장합니다.
두 번째 명령은 Register-ScheduledJob cmdlet을 사용하여 예약된 새 작업을 만듭니다. ScheduledJobOption 매개 변수의 값은 $Opts 변수의 options 개체입니다.
예제 5: 원격 컴퓨터에서 작업 옵션 가져오기
PS C:\> $O = Invoke-Command -ComputerName "Srv01" -ScriptBlock {Get-ScheduledJob -Name "DataDemon" }
이 명령은 Invoke-Command cmdlet을 사용하여 Srv01 컴퓨터에서 DataDemon 작업의 예약된 작업 옵션을 가져옵니다. 이 명령은 옵션을 $O 변수에 저장합니다.
매개 변수
-Id
예약된 작업의 ID 번호를 지정합니다. Get-ScheduledJobOption 지정된 예약된 작업의 작업 옵션을 가져옵니다.
로컬 컴퓨터 또는 원격 컴퓨터에서 예약된 작업의 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-ScheduledJobOption 지정된 예약된 작업의 작업 옵션을 가져옵니다. 와일드카드가 지원됩니다.
로컬 컴퓨터 또는 원격 컴퓨터에서 예약된 작업의 이름을 얻으려면 Get-ScheduledJob cmdlet을 사용합니다.
형식: | String |
Position: | 0 |
Default value: | None |
필수: | True |
파이프라인 입력 허용: | True |
와일드카드 문자 허용: | False |
입력
예약된 작업을 Get-ScheduledJob Get-ScheduledJobOption
출력
관련 링크
- 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