$file = "C:\Users\pgeeraert\Downloads\connections.xml" $destination = Get-content $file $data = foreach ($line in $destination) { $info = $line -split "\s+" $hash = [ordered]@{} for ($i=0;$i -lt $names.count;$i++) { $hash.add($names[$i],$Info[$i]) } #end For [pscustomobject]$hash } #end Foreach $data