Here is a somewhat unknown parameter: -RepeatHeader! What does it do?

Let’s assume you want to see results page by page (which only works in a console, not the PowerShell ISE):

 
PS> Get-Process | Out-Host -Paging 
 

The output now is paused per page until you press SPACE. However, the column headers are displayed only on the first page.

A better output can be produced like this:

 
PS> Get-Process | Format-Table -RepeatHeader | Out-Host -Paging 
 

Now, the header is re-displayed per page. -RepeatHeader is available in all Format-* cmdlets. Again, this trick works only in console-based PowerShell hosts and won’t work in the PowerShell ISE. The reason is: PowerShell ISE does not have a fixed page size, so it does not know when a page ends.



You are a PowerShell Professional, passionate about improving your code and skills? You take security seriously and are always looking for the latest advice and guidance to make your code more secure and faster? You’d love to connect to the vibrant PowerShell community and get in touch with other PowerShell Professionals to share tricks and experience? Then PowerShell Conference EU 2020 might be just the right place for you: https://psconf.eu (June 2-5, 2020 in Hanover, Germany).

It’s a unique mixture of classic conference with three parallel tracks filled with fast-paced PowerShell presentations, and advanced learning class with live discussions, Q&A and plenty of networking.

Secure your seat while they last: https://psconf.eu/register.html. Help build the agenda and make this “your” event by submitting hypothetical sessions you’d like to hear: https://powershell.one/psconfeu/psconf.eu-2020/reverse-cfp. And if you’d like to present yourself and join the psconf.eu speakers’ team, submit proposals: https://sessionize.com/psconfeu/.

Twitter This Tip! ReTweet this Tip!

Anonymous