I am running vulnerability scans and I have a raw CSV file that I import. I remove the Risk = None from the file and then pull the information I need (Name of vulnerability, Host, Risk, CVE, Description, Solution, See Also).
What I would like to do is chop the file up even more and create
- Separate CSV files based on the vulnerability Name. the actual file name does not have to be the name of the vulnerability it can remain static V001, V002, ...
Populate the separate files with the results based on each vulnerability Name (Host, Risk, CVE, Description, etc.). So in file V001 all affected hosts for V001 vulnerability will populate in that file and so on.
$all = Import-Csv c:\scan.csv $all_with_none_removed = $all | Where-Object {$_.Risk -ne "None"} $Sumary_By_Vuln = $all_with_none_removed | select Name, Host, Risk, CVSS, CVE, Description, Solution, 'See Also' | Sort-Object Name $Sumary_By_Vuln | Export-Csv C:\final.csv