To create a foreach loop, you will use the foreach keyword, an iterator variable, and enumerable object and a body for the loop. Here is an example of looping over all the processes on a system using PowerShell.

$Processes = Get-Process
foreach($process in $processes)
    Write-Host $process.Name

In the above example, the $processes variable contains the list of processes on the machine as returned by Get-Process. The foreach loop will iterate over each item in the loop and store the individual object in the $process variable. We then use Write-Host to print out the name.