PowerShell Genie

Out-Host

Use Out-Host to send output to the host for display, optionally one screen at a time.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Out-Host [-Paging] [-InputObject <PSObject>] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Out-Host [-Paging] [-InputObject <PSObject>] [<CommonParameters>]
  1. Stage 1Out-Host-Paging -InputObject

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Select first 5

    1PS> Get-Service | Select-Object -First 5 Name, Status | Out-Host
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name      Status
    --------  -------
    BITS      Running
    Dnscache  Running
    Spooler   Stopped
    WinRM     Running

    Get-Command -Paging

    1PS> Get-Command | Out-Host -Paging
    Show reference output

    Sample output · fictional data, shaped like the real thing

    CommandType  Name           Version  Source
    -----------  -------------  -------  -------------------------------
    Cmdlet       Get-Process    7.5.2    Microsoft.PowerShell.Management
    Cmdlet       Get-Service    7.5.2    Microsoft.PowerShell.Management
    Cmdlet       Get-ChildItem  7.5.2    Microsoft.PowerShell.Management

    Select first 3

    1PS> Get-Process | Select-Object -First 3 Name, Id | Out-Host
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name    Id
    ------  -----
    chrome  9184
    Code    6620
    pwsh    11268

    Parameters

    Parameter definitions:

    • -Paging
    • -InputObject

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Out-Host when you need to send output to the host for display, optionally one screen at a time. Review syntax and sample output, then try an example in the browser lab. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: A variable receiving no result can be expected after Out-Host consumes the input for display. Return the objects separately and use host display only at the presentation boundary. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Write-Output. Out-Host sends output to the host display; Write-Output sends it along the success pipeline. Sending a result to the host prevents ordinary downstream object processing. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Out-Host reference on Microsoft Learn

    Recap

    Out-Host Use Out-Host to send output to the host for display, optionally one screen at a time.

    Next: Test-NetConnection
    Genie guideOut-Host

    Use Out-Host to send output to the host for display, optionally one screen at a time. The console below is pre-loaded — run it, then change a value and run it again.