Quality: Cleanup of Get-Job examples #10448
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
Prior to this PR,
Get-Job
has a few examples that needs to be cleaned up to align with the code formatting guidelines.It also has a few examples that are non-functioning.
Example 8 states:
The fifth command uses Invoke-Command to run a Get-Job command on the S2 computer.
It then does:
Invoke-Command -ComputerName S2 -ScriptBlock {Start-Job -ScriptBlock {Get-EventLog System}}
This is exactly what the
forth command
does in the same example.I edited this to align with how one can manage a remote job on a remote computer
In example 4, the example is about how Get-Job accepts pipeline input. It does, but by propertyname. And since the example passes a simple string it will throw an error. I changed it so it passes a PSCustomObject with a Command NoteProperty, this works in 5.1 - 7.4.
I decided to change a few examples from Illustrative to Executable, since I feel that users would benefit more from being able to copy/paste them. It would be good if there where some guidelines on how to think here, generally.
My intention is to fix all the -Job cmdlets, but
Get-Job
had so many potential changes that I decided to split it from the future PR of the other cmdlets.Get-Job
cmdlet #10446PR Checklist