I am using this snipit of code to parse mbsa files to an excell worksheet, but i would much rather create a ps object out of it. I am stuck on how to do that with the exsisiting switch.
Any help would be great
foreach ($file in $files.FullName) { [XML]$ScanResult = Get-Content $file $Scanned = $ScanResult.SecScan.Check | select Name, Advice $Server = $ScanResult.SecScan.Machine foreach($Scan in $Scanned) { # if Advice doesn't start with a numeric value then set it equal to 0 if( $Scan.Advice -match '^(?[0-9]*)'){$Advice=$matches.cnt} else{$Advice=0} $Style.Cells.Item($intRow, 1) = $Server switch ($Scan.Name) { "Developer Tools, Runtimes, and Redistributables Security Updates" {$Style.Cells.Item($intRow, 2) = $Advice;break} "Windows Security Updates" {$Style.Cells.Item($intRow, 3) = $Advice;break} "Office Security Updates" {$Style.Cells.Item($intRow, 4) = $Advice;break} } } $intRow = $intRow + 1 }