# Console output appears out of order in PS v5

**URL:** <https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722>\
**Category:** PowerShell Help\
**Created:** [June 28, 2016, 12:40pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722 "2016-06-28T12:40:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnoud-jansveld](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/arnoud-jansveld/32/627_2.png) [@arnoud-jansveld](https://forums.powershell.org/u/arnoud-jansveld)\
**Post date:** [June 28, 2016, 12:40pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722/1 "2016-06-28T12:40:22Z")

</div>

Has anyone else seen output display out of order in PowerShell 5?

```
C:\Users> Write-Host "Before"; Get-Service e* | select Status, Name, DisplayName; Write-Host "After"
Before

After
 Status Name DisplayName
 ------ ---- -----------
Stopped EapHost Extensible Authentication Protocol
Running EFS Encrypting File System (EFS)
Running eventlog Windows Event Log
Running EventSystem COM+ Event System
```

We noticed this after we upgraded to WMF5. It isn’t causing any functional problems per se, but it can definitely confuse some people; scripts that uses Write-Host, Write-Verbose etc. to track the flow of the code could produce some surprising results.

I created a UserVoice bug report with more details (please upvote if you think this needs attention): [Bug: Console output appears out of order](https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/14925213-bug-console-output-appears-out-of-order)

---

<div class="post-metadata">

**Author:** ![neil-kronberg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/neil-kronberg/32/629_2.png) [@neil-kronberg](https://forums.powershell.org/u/neil-kronberg)\
**Post date:** [June 28, 2016, 12:45pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722/2 "2016-06-28T12:45:07Z")

</div>

Try Write-Output instead. Write-Host writes directly to the screen which could cause it to appear before a command that writes to the pipeline (Get-Service), even though it’s technically entered after that command.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [June 28, 2016, 12:46pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722/3 "2016-06-28T12:46:33Z")

</div>

Or, “Never use Write-Host.” There are also downsides to putting extraneous stuff into the pipeline, as it can confuse the formatting subsystem.

---

<div class="post-metadata">

**Author:** ![arnoud-jansveld](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/arnoud-jansveld/32/627_2.png) [@arnoud-jansveld](https://forums.powershell.org/u/arnoud-jansveld)\
**Post date:** [June 28, 2016, 1:02pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722/4 "2016-06-28T13:02:18Z")

</div>

Agreed on not using Write-Host, so let’s substitute Write-Verbose - same issue.

The UserVoice post has more details (including some info added by Tim Curwick about timing changes).

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:41pm UTC](https://forums.powershell.org/t/console-output-appears-out-of-order-in-ps-v5/6722/5 "2024-05-16T20:41:00Z")

</div>


