PS  Powershell Tutorial
  • Tutorials
  • File System
  • Learn PS
  • Scripting
  • PS With Technology
  • Commands
  • V6
  • Admin
  • AD
  • Questions
  • String Operations
  • More
    ✕
    Powershell Tutorials
    • Tutorials
    • Admin
    • Commands
    • V6
    • AD
    • String Operations
    Powershell Scripts
    • Questions
    • File System
    • Learn PS
    • Scripting
    • PS With Technology
    • Powershell Tutorial Start
    • Powershell Introduction
    • Differenciating between Objects Text
    • Exploring File System Navigation Manipulation
    • Finding Creating Using Variables
    • Working with PSProviders and PSDrives
    • Working With Registry Keys
    • Working with WMI CIM objects
    • Using Powershell 6.0 :- Create-shortcuts-lnk-or-url-files-with-powershell
    • Accessing the alias drive in powershell 3
    • Adding functions to the powershell ise menu
    • Basic line editing tricks powershell
    • Breaking down a powershell script
    • Casting values in powershell
    • Changing powershells look and feel
    • Constant and read only variables
    • Create xml variable powershell
    • Creating aliases in powershell
    • Creating and changing a powershell profile
    • Creating persistent aliases in powershell
    • Customizing the ise in powershell
    • Deleting aliases in powershell
    • Download file website powershell
    • Getting acquainted with the ise
    • Getting the right output in powershell
    • Getting to know tab expansion
    • Growing arrays dynamically in powershell
    • Handling complex powershell scripts
    • Hashtables in windows powershell
    • How to impersonate someone in powershell
    • How to use powershells invoke wmimethod
    • Installing windows powershell 2
    • Query XML data Powershell
    • Stringing powershell commands together 2
    • Understanding automatic variables in powershell
    • Understanding if else statements in powershell
    • Understanding powershell commands
    • Understanding powershell operators
    • Understanding powershell variables and datatypes
    • Understanding the windows management instrumentation wmi part ii
    • Understanding the windows management instrumentation wmi
    • Using loops in powershell part i
    • Using loops in powershell part ii
    • Using loops in powershell part iii
    • Using loops in powershell part-iv
    • Using loops in powershell part-v
    • Using pipelines to streamline powershell commands
    • Using regular expressions in powershell part-i
    • Using the switch statement in powershell
    • Working binary powershell
    • Working with powershell objects via variables
    • Writing your first powershell command
    Prev
    Next

    Using Pipelines to Streamline PowerShell Commands

    If you want to query information from one computer, you use the Windows Management Instrumentation (WMI) to query that information. In the case you want to query a series of computers, you have to provide a list of computer names and such. This is a completely different query. How do you run the query command? Get the list and run a command to query WMI. Well, this is where you will need to pipeline. In this tutorial, you will learn how to use Pipelines to streamline commands in PowerShell.

    Setup

    If you have not already done so, click open Windows PowerShell ISE.

    Step one.

    What is a pipeline? A pipeline occurs when one takes the output of one command and directs it to the input of another command. Essentially, it takes out the additional processes by stringing the commands together. Otherwise known as piping the output of one command to another.

    Piping a command to another would be ran much like the following in Windows Command Prompt:

    Example

        ipconfig | find "IP Address"
    
       

    Copy and Try it

    The particular sequence uses the ipconfig to list the IP configurations of all the network adaptors in the system and pipes it out to the find the command, then it is then filtered and displays only the few lines that contain the string "IP Address". The issue with this method, is that it relies on manipulating the text output of the command before that.

    Step two.

    PSH uses the same convention of using the pipe (|) character to denote piping the output of one command to another, however in the background, the behavior is different. PSH doesn't pass text amongst commands, it passes objects. The arrangement is vital because the receiving command is able to access the various attributes of the object directly instead of trying to parse out strings to interpret the data. The importance of objects instead of text? Text may change on you, objects, due to their structure, will not change on you.

    Remarks last but not least…

    Pipelining actually saves a lot of time and prevents having to be the middleman between commands. Join us next time for additional Windows PowerShell tutorials! Till then…

    Prev
    Next
    • Useful Resources
    • POWERSHELL SELECT STRING
    • AD
    • Questions
    • Admin
    PowershellTutorial

    of use and privacy policy.

    • Feedback
    Tutorials
    • String Operations
    • AD
    • Questions
    E-mail list

    Subscribe to PowershellTutorial email list and get Cheat Sheets, latest updates, tips & tricks about Powershell to your inbox.

    We respect your privacy.

    • HOME
    • Disclaimer
    • sitemap
    2018 PowershellTutorial.net. All Rights Reserved.