About 156,000 results
Open links in new tab
  1. about_Foreach - PowerShell | Microsoft Learn

    Jan 19, 2024 · The foreach statement is a language construct for iterating over a set of values in a collection. The simplest and most typical type of collection to traverse is an array. Within a …

  2. Powershell foreach (list the array item command referenced)

    Aug 28, 2018 · $adGroupList = 'ADGroup1', 'ADGroup2', 'ADGroup3' foreach ($adGroup in $adGroupList) { $adGroupMembers = (Get-ADGroupMember $adGroup).Name foreach …

  3. PowerShell ForEach Loop [With Examples]

    Jul 11, 2024 · To become an expert in PowerShell, you should know how to work with the foreach loop. I will explain the nested foreach loop and error handling in a PowerShell foreach loop in …

  4. How to Loop Through an Array in PowerShell? - SPGuides

    Dec 2, 2024 · In this tutorial, I explained how to loop through arrays in PowerShell using different methods, including the ForEach loop, the ForEach-Object cmdlet with the pipeline, and the For …

  5. PowerShell ForEach: Everything You Need to Know

    May 30, 2023 · When you have a collection (such as an array or a list), you can use the .ForEach() method to iterate over each element of the collection and perform a specified …

  6. PowerShell ForEach Loops: Types and Best Practices - ATA Learning

    Jan 23, 2020 · foreach is an internal PowerShell keyword that’s not a cmdlet nor a function. The foreach statement is always used in the form: foreach ($i in $array) . Using the example …

  7. ForEach method - PowerShell - SS64.com

    ForEach (method) Loop through a collection (or a set of properties) and perform an operation (execute a block of statements) against each.

  8. PowerShell Loop Thru Array: A Quick Exploration

    In PowerShell, you can iterate through an array using a foreach loop to perform actions on each element efficiently. Here's a simple example demonstrating this: $array = @(1, 2, 3, 4, 5) …

  9. Powershell Loop Through Array: A Detailed Guide

    To loop through an array in PowerShell, you can use the ‘for’ loop, the ‘foreach’ loop, or the ForEach-Object cmdlet. These loops enable you to iterate through an array and specify …

  10. PowerShell For Loop, ForEach, and Do While/Until Explained

    Apr 6, 2021 · To process each item in an array or collection you can use the ForEach functions in PowerShell. There are two types of foreach functions in PowerShell, we have foreach and …

Refresh