Match and Update Csv

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of H Man H Man 1 year, 11 months ago.

  • Author
    Posts
  • #24165
    Profile photo of H Man
    H Man
    Participant

    Hello

    I am working with a Csv master list. After gathering data and exporting it to a "working set "csv list Id like to update my master list by matching computer names and update my 'online' field

    any help would d be greatly appreciated.

    heres what I have so far

    $master = "C:\MasterList.csv"
    $working = "C:\workingset.csv"
    
    $masterlist = ipcsv $master
    $workingset = ipcsv $working
    
    
    
     $Output = foreach ($m in $masterlist) {
        foreach ($w in $workingset) {
            if ($m.computername -like "*$($w.computername)*") { $m.online = $w.online }
       
        }
        $i
    }
    $Output | Export-Csv $CsvFile -NoTypeInformation
    
  • #24166
    Profile photo of H Man
    H Man
    Participant

    I solved the issue I needed to remove $output and add

    $masterlist | Export-Csv $master -NoTypeInformation

You must be logged in to reply to this topic.