Powershell Tutorial
Introduction to Powershell Managing History of Powershell Commands Cmdlet, Alias, Function and Module in Powershell PSDrive Profile in Windows Powershell Variable Management in Powershell Passing values to parameters from file Creating files and directories Basic File System commands Finding the patterns in files Unique command Replacing patterns in files Comparing objects Sorting objects Other object commands Getting members of an Object Managing processes Managing Jobs IO redirection Piping System Commands Network commands Service Commands WMI(Windows Management Instrumentation) CIM (Common Information Model) Formatting output exporting output XML processing Powershell Module Management Remote computer managementPiping in windows powershell
Piping allows you to send the output of one command as an input to another command. For example – Below command will pipe the output of get-help command to “findstr” command.
> get-help * | findstr “Cmdlet”
Another example – “Get-Process” command shows the list of all processes on the screen in ascending order. But let us say you want to display the output in descending order. Then you can use piping as shown in below command.
> Get-Process | sort – Descending
As you can see in above command, we have used “|” pipe to send the output of “Get-Process” command to Sort command. Another example on piping is given below. Here only top 5 processes will be displayed sorted by Id.
> Get-Process | Sort Id | select -First 5
In below example, we are killing all processes with name notepad.
> Get-Process -Name notepad | Stop-Process
In below example, we are displaying all methods supported by process object.
> Get-Process | Get-Member -MemberType Method
Web development and Automation testing
solutions delivered!!