Control additional output options in PowerShell


PowerShell provides a variety of other options for controlling output. For example, you might not want to scroll through a long list of data returned by a command such as Get-ADUser. You can use the Out-Host command to force PowerShell to pause during each page of data it returns. You can force Out-Host to page the output when you use the -Paging parameter which causes PowerShell to prompt you for input after it displays one page of data on the screen.

If you want to print output, you can use the Out-Printer command to pipe data to your default printer (if you specify no parameter) or to a specific printer (if you specify the -Name positional parameter). If you want to review, sort, filter, and analyze output, and you don't need or want to keep a more permanent copy of the data stored in a CSV file or spreadsheet, you can send the output to a grid view window by using the Out-GridView command. The grid view window is an interactive window that works very much like a Microsoft Excel spreadsheet. It allows you to sort different columns, filter the data, and even copy data from the window to other programs. The one thing you can't do is save the data directly from the grid view window.