Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 2.0 » ForEach-Object

ForEach-Object - Powershell 2.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

ForEach-Object

Short description
Performs an operation against each of a set of input objects.

Syntax


Description
The ForEach-Object cmdlet performs an operation on each of a set of input objects. The input objects can be piped t
o the cmdlet or specified by using the InputObject parameter.
    
The operation to perform is described within a script block that is provided to the cmdlet as the value of the Proc
ess parameter. The script block can contain any Windows PowerShell script. 
    
Within the script block, the current input object is represented by the $_ variable.
In addition to using the script block that describes the operations to be carried out on each input object, you can provide two additional script blocks. One, specified as the value of the Begin parameter, runs before the first in
put object is processed. The other, specified as the value of the End parameter, runs after the last input object is processed. 
    
The results of the evaluation of all the script blocks, including the ones specified with Begin and End, are passed
down the pipeline.