Powershell

How can we add columns to csv and update only first row of the same csv file?

You would actually Import the CSV, update the object, and then export the csv. If we had a csv with the following data:

Age Name
--- ----
 22 John
 21 Sue 

We want to get the CSV and select only the first line, add a property for Computername and then export the csv:

$myCsv = Import-CSV C:\Temp\mycsv.csv | Select -First 1
$myCsv | Add-Member -MemberType NoteProperty -Name ComputerName -Value $env:COMPUTERNAME
$myCsv | Export-CSV -Path C:\temp\mycsv.csv -NoTypeInformation

Now your CSV would look like this:

Age Name ComputerName 
--- ---- ------------ 
22  John LENOVOY50-ROB

Keep in mind that there are many ways to do things, so with the limited information you are providing, this would work.

Thank you Rob. It worked.