I am trying to join together two csv\'s. One of the CSVs contain the column I want to add to the other but when the csv is exported the column added is blank.
$csv1
here you go:
$csv1 = Import-Csv -Path ".\VLAN.csv"
$csv2 = Import-Csv -Path ".\Hostname.csv"
$arr = @()
#If($csv1.count -eq $csv2.count){
for($i=0; $i -lt $csv1.Count; $i++){
$temp = New-Object psobject
$temp | Add-Member -MemberType NoteProperty -Name VLAN -Value $csv1[$i].Vlan
$temp | Add-Member -MemberType NoteProperty -Name HOST -Value $csv2[$i].Host
$arr+=$temp
}
#}
$arr | Export-Csv combined.csv -NoTypeInformation
$csv1 |
Join $csv2
Results
VLAN Host
---- ----
1 NETMAN
2 ADMIN
3 CLIENT