Private/Get-MsrcThreatExploitStatus.ps1
Function Get-MsrcThreatExploitStatus { <# .SYNOPSIS Split a semicolon delimited string into a custom object .DESCRIPTION Split a semicolon delimited string into a custom object .PARAMETER ExploitStatusString The Exploit Status string, which is delimited .EXAMPLE "Publicly Disclosed:No;Exploited:No;Latest Software Release:Exploitation More Likely;Older Software Release:N/A;" | Get-MsrcThreatExploitStatus .EXAMPLE Get-MsrcThreatExploitStatus -ExploitStatusString "Publicly Disclosed:No;Exploited:No;Latest Software Release:Exploitation More Likely;Older Software Release:N/A;" #> [CmdletBinding()] Param ( [Parameter(Mandatory,ValueFromPipeline)] [string]$ExploitStatusString ) Begin {} Process { $s = [PSCustomObject]@{ PubliclyDisclosed = '' Exploited = '' LatestSoftwareRelease = '' OlderSoftwareRelease = '' # DenialOfService = 'N/A' } $ExploitStatusString -split ';' | ForEach-Object { $Name,$Value = $_ -split ':' Switch ($Name) { 'Publicly Disclosed' { $s.PubliclyDisclosed = $Value ; break } 'Exploited' { $s.Exploited = $Value ; break } 'Latest Software Release' { $s.LatestSoftwareRelease = $Value ; break } 'Older Software Release' { $s.OlderSoftwareRelease = $Value ; break } default {} } } $s } End {} } |