Skip to content

Should Write-Host still be avoided? #1118

Open
@jaredmmartin

Description

@jaredmmartin

It's always been recommended to avoid using Write-Host because it outputs only to the console and not to any of the standard output streams. As of PowerShell 5.0, Write-Host is just a wrapper for Write-Information and thus outputs to the standard output streams similar to the other Write-* cmdlets.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-host?view=powershell-6

Should the use of Write-Host still be flagged as something to be avoided? Is it possible to implement a rule that only flags the use of Write-Host if the computer is running a version of PowerShell earlier than 5.0?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions