Iterate through array
Powershell is very “powerful” and super weird when you’re used to writing code in C# or Java or anything that looks like code really. Anyhow this example demonstrates how to iterate through a an array in powershell.

Function SetNameList($dataList)
{
   #declare an empty array
   $arr = @()
   #add names from dataList to empty array
   foreach($name in $dataList)
   {
      $arr += $name 
   }
   return $arr
}
Advertisements