Powershell: Learning to use the pipeline

This chapter goes over using the pipeline command to string together PowerShell commands.

The important commands covered are the following:

Export-Csv
Export-Clixml
Out-File
Out-Printer
Out-GridView
Compare-Object
ConvertTo-HTML

This chapter covered some pretty useful material.  It showed how to take output from something like Get-Process or Get-Service and exporting it to an easy to read file.

Here are some examples of the commands in action:

Export-Csv

Export-Csv: I included the Import-Csv command here so you could see what the results were and piped it to more

 

Export-CliXml

Here”s the same example with Export-CliXml

Get-Service pipeline Out-GridView

Out-GridView: I liked this command a lot; it requires that you have PowerShell ISE and .Net Framework 3.5.1 installed.  This command allows you to take the output from a PowerShell command and sends it to an interactive table in a separate window.

Compare-Object

Compare-Object: Or Diff for short may be one of the most useful commands in this chapter.  This command allows you to take the output from something like Get-Service output it to a file (like with Export-Csv) and compare the differences on another box!
I ran Get-Process on my Windows 2012 server and then compared it with the Get-Proess (ps) output on a Windows 2008 server

Leave a Reply

Your email address will not be published. Required fields are marked *