## set the path to the xml xccdf file. $BenchMarkFilePath = '~\Documents\U_Windows_2012_and_2012_R2_MS_STIG_V2R6_Manual-xccdf.xml' ## load the content as XML [xml]$Stigx = Get-Content -Path $BenchMarkFilePath -EA Stop # start by parsing the xccdf security benchmark if($Stigx){ $StigCollection = @() # loop through the xccdf benchmark collecting data into an object collection foreach ($rule in $StigX.Benchmark.Group.Rule){ # create a new PSObject collecting and stripping out as required. $STIG = New-Object -TypeName PSObject -Property ([ordered]@{ RuleID = $rule. id RuleTitle = $rule.title Severity = $rule.severity VulnerabilityDetails = $($($($rule.description) -split '')[0] -replace '', '') Check = $rule.check.'check-content' Fix = $rule.fixtext.'#text' ControlIdentifier = $rule.ident.'#text' Control = $null # control is null as it will be added from the CCI List }) $StigCollection += $STIG }# close foreach }# close if