I am writing a Script which will fetch a list of Computers from AD having a specific Operating System and then will compare the 'Name' column of this sheet with another Workbook which has the list of Computers reporting to the AV Agent. Kind of like using the VLOOKUP Function to check the mismatch and then build a Pivot table and the Graph based on the same data. However ; I am kind of stuck on the comparison of "Names" as it is giving a blank sheet with the Indicators. I want the comparison table and with no indicators. Can that be achieved in Powershell? Any help on the same would really be great. The Code is as follows :-
import-module ac*
Get-ADComputer -filter { OperatingSystemVersion -Like '*6.1*' -and Enabled -eq "true"} -SearchBase 'OU=Computers,OU=IM,dc=miraje,dc=intr' -Properties '*' | Select Name,OperatingSystem,Status, OperatingSystemVersion, `
LastLogonDate,CanonicalName | Export-Csv -NoType "C:\Temp\ExportPC3.csv" -Encoding UTF8
$file1 = import-csv -Path "C:\Temp\ExportPC3.csv"
$file2 = import-csv -Path "C:\Temp\AV_Machines.csv"
$result = Compare-Object $file1 $file2 -property Name -IncludeEqual | Export-Csv -NoType "C:\Temp\ExportPC2.csv" -Encoding UTF8