PowerTip of the Day, from PowerShell.com:
You might know the more.com tool: when you pipe output to more.com, 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. more.com first collects all results before it starts paginating it. This takes a long time and a lot of resources.
That's why you should avoid more.com 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.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.