MRS
asked on
Powershell script to compare two txt files and create 3rd txt file with differences
I have two .txt files. One is with up to date 2 different NIC drivers brand and up to date versions that I will maintain manually:
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
and one .txt file with columns like:
PSComputerName : PC1
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
PSComputerName : PC2
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
PSComputerName : PC3
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
PSComputerName : PC4
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 10-31-2012
DriverVersion : 12.2.45.0
PSComputerName : PC5
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
How do I create a script in PowerShell that will match "DriverDesc" between two .txt files, when it finds the match, compare "DriverVersion" field. If "DriverVerison" matches between two proceed with next one, if it doesn't grab the "PSComputerName" and below fields (DriverDesc, DriverDate, DriverVersion) and create separate (3rd) .txt file that will have all the fields like second .txt file but just the PC's that are not up to date with NIC drivers?
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
and one .txt file with columns like:
PSComputerName : PC1
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
PSComputerName : PC2
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
PSComputerName : PC3
DriverDesc : Realtek PCIe GBE Family Controller
DriverDate : 6-18-2013
DriverVersion : 7.73.618.2013
PSComputerName : PC4
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 10-31-2012
DriverVersion : 12.2.45.0
PSComputerName : PC5
DriverDesc : Intel(R) 82579LM Gigabit Network Connection
DriverDate : 5-15-2013
DriverVersion : 12.6.45.0
How do I create a script in PowerShell that will match "DriverDesc" between two .txt files, when it finds the match, compare "DriverVersion" field. If "DriverVerison" matches between two proceed with next one, if it doesn't grab the "PSComputerName" and below fields (DriverDesc, DriverDate, DriverVersion) and create separate (3rd) .txt file that will have all the fields like second .txt file but just the PC's that are not up to date with NIC drivers?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You rock! Thanks.
Open in new window
diff.csvref.csv