still very inexperienced in Powershell, but as is well known, every journey begins with the first steps.
I define two arrays in the script:
$array1 = @("server1", "server2")
$array2 = @("SID1", "SID2")
The SID1 and server1 belong together.
I then want to combine the two arrays using a loop: Example:
foreach ($i in $array1) {
Write-Host "Server = ${i}"
}
How can I combine the two arrays? Ideal is: ...
Write-Host "Server=${i}" and SID=${?}"
...
Can the two arrays be built into the foreach so that both values are filled when executing on the write host?
Thanks for your ideas and help.
Many greetings
Carlos
Join-Object script/Join-Object Module(see also: In Powershell, what's the best way to join two tables into one?):$array1 |Join $array2 -Name Name,Id