If you've got a Cisco ACS server or just have a bunch of CSV files that you'd like to parse this post is for you. I needed to find all unique instances of a MAC address in an EAP Type Name column in a bunch of CSV files. This is the PowerShell script I came up with that worked out great.

This script grabs all CSV files in a directory then finds all instances of where the EAP Type Name column in each CSV equals MS-PEAP. Based on the rows it finds, it then takes out the caller-id column and groups them to remove all of the duplicate instances. It then sort all of these unique caller-ids and export that list to a CSV.

$log_path = '\\cisco-acs\c$\Program Files\CiscoSecure ACS v4.2\Logs\Passed Authentications'
Get-ChildItem $log_path -Recurse -Include *.csv | 
    ForEach-Object { import-csv $_.FullName | Where-Object {$_.'EAP Type Name' -eq 'MS-PEAP'}} | 
    ForEach-Object {$_.'caller-id'} | Group-Object | Select-Object Name | sort Name | 
    Export-Csv -Path 'DevicesUsingPEAP.csv' -NoTypeInformation

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!