Fix Test-Remainder invocation to pass three arguments, not two.#12831
Fix Test-Remainder invocation to pass three arguments, not two.#12831sdwheeler merged 2 commits intoMicrosoftDocs:mainfrom
Conversation
You state: "The following example declares a Value parameter that's mandatory and a Remaining parameter that accepts **all the remaining parameter values** that are submitted to the function. You want to demonstrate this with this invocation: `Test-Remainder first one, two` But your "all the remaining parameter values" is merely one value: `one, two` is an array. Thus, if you removed `ValueFromRemainingArguments`, the same invocation would yield the same output, so your example **does not** demonstrate the benefit of `ValueFromRemainingArguments`. To fix it, three args have to be passed to the Cmdlet, not just two.
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
There was a problem hiding this comment.
Pull request overview
Updates the PowerShell documentation example for ValueFromRemainingArguments so the invocation actually passes multiple separate remaining arguments, demonstrating the attribute’s behavior correctly.
Changes:
- Adjusted
Test-Remainderexample invocation fromone, two(single array argument) toone two(two distinct arguments).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Learn Build status updates of commit 69808ee: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 47a3080: ✅ Validation status: passed
For more details, please refer to the build report. |
You state: "The following example declares a Value parameter that's mandatory and a Remaining parameter that accepts all the remaining parameter values that are submitted to the function.
You try to demonstrate this with this invocation:
Test-Remainder first one, twoBut your "all the remaining parameter values" is merely one value:
one, twois an array.Thus, if you removed
ValueFromRemainingArguments, the same invocation would yield the same output, so your example does not demonstrate the benefit ofValueFromRemainingArguments.To fix it, three args have to be passed to the Cmdlet, not just two.
PR Summary
In the second arg,
one, two, remove the comma to have three args in total that are passed to the Cmdlet.PR Checklist