Skip to content

Instantly share code, notes, and snippets.

@jasonadsit
Last active January 14, 2021 22:32
Show Gist options
  • Save jasonadsit/c197800b4e03741125bb7a4c7a69ea72 to your computer and use it in GitHub Desktop.
Save jasonadsit/c197800b4e03741125bb7a4c7a69ea72 to your computer and use it in GitHub Desktop.
ParseWindowsComplianceChecks.ps1
$PluginID = '21156'
Get-ChildItem -Filter *.nessus |
Select-Xml -XPath //NessusClientData_v2/Report/ReportHost |
Select-Object -ExpandProperty Node |
Where-Object { $_.ReportItem.GetAttribute('pluginID') -eq $PluginID } | ForEach-Object {
$Tags = $_.HostProperties.tag | Group-Object -Property name -AsHashTable
$ReportItems = $_.ReportItem | Group-Object -Property pluginID -AsHashTable
$ReportItems[$PluginID] | ForEach-Object {
$Reference = $(($_.'compliance-reference' -split ',') -join "`r`n")
$Reference = "$Reference`r`n"
[pscustomobject][ordered]@{
IpAddress = $Tags['host-ip'].'#text'
ComputerName = $Tags['host-fqdn'].'#text' -split '\.' | Select-Object -First 1
CheckName = $_.'compliance-check-name'
Result = $_.'compliance-result'
Reference = $Reference
Solution = $_.'compliance-solution'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment