Last active
February 23, 2022 16:22
-
-
Save jasonadsit/e2ebc4e6234eeba6c504ab1a58e78c19 to your computer and use it in GitHub Desktop.
TenablePluginTextParsing.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-TenablePluginOutput -PluginID $PluginID | ForEach-Object { | |
$IpAddress = $_.IpAddress | |
$NetBiosName = $_.NetBiosName | |
$_.PluginOutput -split "`n`n" | Where-Object { $_ -cmatch '<Block matching regex>' } | ForEach-Object { | |
$Lines = $_ -split "`n" | ForEach-Object { $_.Trim() } | |
$EachOne = @{} | |
$Lines | ForEach-Object { | |
$Key = ($_ -split '\s:\s')[0].Trim() | |
$Value = ($_ -split '\s:\s')[-1].Trim() | |
$EachOne.Add($Key,$Value) | |
} | |
[pscustomobject][ordered]@{ | |
IpAddress = $IpAddress | |
NetBiosName = $NetBiosName | |
Property1 = $EachOne['Property 1'] | |
Property2 = $EachOne['Property 2'] | |
Property3 = $EachOne['Property 3'] | |
PropertyN = $EachOne['Property N'] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment