Skip to content

Commit 6cba2dc

Browse files
authored
Format PowerShell code examples for readability
1 parent a68229f commit 6cba2dc

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

reference/5.1/PSScheduledJob/Get-ScheduledJobOption.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ the job options of each scheduled job.
8181
This example shows how to find job options object with particular values.
8282

8383
```powershell
84-
Get-ScheduledJob | Get-ScheduledJobOption | where {$_.RunElevated -and !$_.WakeToRun}
84+
Get-ScheduledJob |
85+
Get-ScheduledJobOption |
86+
Where-Object {$_.RunElevated -and !$_.WakeToRun}
8587
86-
Get-ScheduledJob | Get-ScheduledJobOption | where {$_.RunElevated -and !$_.WakeToRun} |
88+
Get-ScheduledJob |
89+
Get-ScheduledJobOption |
90+
Where-Object {$_.RunElevated -and !$_.WakeToRun} |
8791
ForEach-Object {$_.JobDefinition}
8892
```
8993

@@ -103,8 +107,12 @@ This example shows how to use the job options that `Get-ScheduledJobOption` gets
103107
job.
104108

105109
```powershell
106-
$Opts = Get-ScheduledJobOption -Name "BackupTestLogs"
107-
Register-ScheduledJob -Name "Archive-Scripts" -FilePath "\\Srv01\Scripts\ArchiveScripts.ps1" -ScheduledJobOption $Opts
110+
$registerScheduledJobSplat = @{
111+
Name = "Archive-Scripts"
112+
FilePath = "\\Srv01\Scripts\ArchiveScripts.ps1"
113+
ScheduledJobOption = Get-ScheduledJobOption -Name "BackupTestLogs"
114+
}
115+
Register-ScheduledJob @registerScheduledJobSplat
108116
```
109117

110118
The first command uses `Get-ScheduledJobOption` to get the jobs options of the BackupTestLogs
@@ -186,7 +194,8 @@ Accept wildcard characters: False
186194

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

191200
## INPUTS
192201

0 commit comments

Comments
 (0)