Research and Development
You might know the more
tool - when you pipe output to more
, the output is displayed page by page.
PS> Get-EventLog -LogName System | more
However, more
can be dangerous as you see here. You will not get any results for a long time, and your CPU load increases. The more
tool first collects all results before it starts paginating it. This could take a long time and a lot of resources.
That's why you should avoid more
and instead use Out-Host
with the parameter -Paging
:
PS> Get-EventLog -LogName System | Out-Host -Paging
You immediately see the benefit: results appear momentarily, and no additional CPU load is created.