Contact Info

Crumbtrail

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

ForEach-Object - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

ForEach-Object

Description
Loop for each object in the pipeline

Usage


Options
-process ScriptBlock[]
        A block of powershell script that is applied to each incoming object.
        
    -inputObject psobject
        Accepts an object that the script block specified in the process parame
        ter will act upon. Enter a variable that contains the objects or type a
         command or expression that gets the objects.
        
    -begin scriptblock
        A script block to run before processing any input objects.
        
    -end scriptblock
        A script block to run after processing all input objects.
 
   CommonParameters:
        -Verbose, -Debug,-ErrorAction,-ErrorVariable, -OutVariable.

Example(s)
Loop for each object in the pipeline