Hello
I have 2 csv file that i need to compare and output to a new txt file. Logic is if execlusion.csv list match sms.csv list, delete from sms.csv and write it to result.txt file. As example below, i am trying to get the value of (aaa4, aaa5, aaa6, aaa7,aaa8)
but i am getting (zzzz1,zzz2,asdf3,asdf4,tqer3,aaa4,aaa5,aaa6,aaa7,aaa8).. Please help.
$smscsv = import-csv C:\temp\sms.csv
$execusioncsv = import-csv C:\temp\exclusion.csv
$result = Compare-Object -ReferenceObject $smscsv.'computer name' -DifferenceObject $execusioncsv.'computer name' |% {$_.inputobject} | out-file c:\temp\result.txtSMS.CSV
| Computer Name | Last Logged On | HardWare Model | IP Address |
| aaa1 | bob1 | hp | 123.1.1.1 |
| aaa2 | bob2 | hp | 123.1.1.2 |
| aaa3 | bob3 | hp | 123.1.1.3 |
| aaa4 | bob4 | hp | 123.1.1.4 |
| aaa5 | bob5 | hp | 123.1.1.5 |
| aaa6 | bob6 | hp | 123.1.1.6 |
| aaa7 | bob7 | hp | 123.1.1.7 |
| aaa8 | bob8 | hp | 123.1.1.8 |
| aaa9 | bob9 | hp | 123.1.1.9 |
| aaa10 | bob10 | hp | 123.1.1.10 |
EXECLUSION.CSV
| ||||||||||||||