1st CSV file
ApplicationName,C:DriveSpace,D:DriveSpace,ProcessorCount,CoreCount,BaseMemory,BaseOU,ApplicationVersion,PatchList,ARCHITECTURE
SCOMLAB,49,100,1,2,8192,PriyaLAB,7.1,a,b,c,64-bit
2nd CSV file
ServerName,MODEL,OS,ARCHITECTURE,RAMinMB,CPU,SPEEDinGHz,PHYSICAL,CORE,Drive1,Drive2
Priya.testlab.com,VMware Virtual Platform,Microsoft Windows Server 2012 R2 Standard,64-bit,2767,Intel64 ,2.4,8,1,C:49.51,D:100.00
I need to compare the RAMinMB of 2nd csv file with the first csv file BaseMemory, if there is any change then write the present value in 2nd csv file and all the data of 2nd csv file to a 3rd csv file.
below is my sample code which I am trying to do through. Nothing seems to be getting captured.
###########Script #########
$BaseCSV = import-csv -Path “D:\2nd.csv”
$NewCSV = import-csv -Path “D:\1st.csv”
$output = @()
forEach ($Column in $BaseCsv) {
$result = $NewCSV | Where-Object {$Column.ARCHITECTURE -eq $_.ARCHITECTURE}
$OldARCHITECTUREvalue = $result.ARCHITECTURE
$output += New-object PSObject -property @{
ServerName = $Column.ServerName
Model = $Column.Model
OS= $Column.OS
Architecture= $Architecture
}
}
$output | select-object SERVERNAME,MODEL,SERIAL,OS,ARCHITECTURE| Export-Csv -Path “D:\TestCompare\change.csv” -NoTypeInformation -Force