Author Posts

July 8, 2017 at 7:06 pm

Hi Guys

Does anyone have an example where I can iterate through an array using a for or for if loop?

Would like to use this to generate automated emails.


July 8, 2017 at 7:15 pm

You want a ForEach loop.

ForEach ($item in $array) {
# variable $item contains one thing from $array

PowerShell does not have a "for if" loop. Run "help about_foreach" in the shell for more.