PowerShell Loop Through Array

Leave a comment

In this post, we will look at how to loop through an array in PowerShell.

We can define our array as:

$myArray = “one”, “two”, “three”

And loop through it like below:

foreach ($arr in $myArray) {
Write-Output $arr
}

Running this, we get:

 

Carl de Souza
Keep learning. Keep building.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.

Subscribe on YouTube →
Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

Leave a Reply

Your email address will not be published. Required fields are marked *