Skip to content

Write-Host -Object: "Value from remaining arguments" incorrectly documented as False #13193

Description

@Raffaelerrr

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Typo in Get-Foo cmdlet" instead of "Typo."
  • Verify Version: If there is a mismatch between documentation and the behavior on your system, ensure that the version you are using is the same as the documentation. Check this box if they match or the issue you are reporting is not version specific.

Links

Summary

The Microsoft Learn documentation for Write-Host (PowerShell 7.6) incorrectly states that the -Object parameter has Value from remaining arguments: False.

In the actual PowerShell 7.6.0 source, -Object is declared with ValueFromRemainingArguments = true:

https://github.com/PowerShell/PowerShell/blob/v7.6.0/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteConsoleCmdlet.cs#L20

That matches runtime behavior: multiple positional values are collected into -Object, e.g. Write-Host a b c works, and -Separator applies between them. Local Get-Help Write-Host -Parameter Object also reports FromRemainingArguments.

Doc page: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/write-host?view=powershell-7.6

Expected fix: update the -Object parameter metadata so Value from remaining arguments is True (and ideally note Accept pipeline input: True (ByValue, FromRemainingArguments) for consistency with Get-Help).

Details

The Learn page for Write-Host (7.6) shows -Object with:

  • Value from remaining arguments: False

But in PowerShell v7.6.0 source, -Object is:

[Parameter(Position = 0, ValueFromRemainingArguments = true, ValueFromPipeline = true)]

Runtime behavior matches the source, e.g.:

Write-Host a b c -Separator ' | '
# a | b | c

Suggested Fix

Suggested Fix
Update the -Object parameter metadata in the 7.6 (and any other affected version) docs so Value from remaining arguments is True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue-doc-bugIssue - error in documentationneeds-triageWaiting - Needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions