$outfile = "c:\veeam-app-detection.html" asnp veeampssnapin $rps = Get-VBRRestorePoint $ids = $rps | % { $_.ObjectId } | Sort-Object | Get-Unique $apps = "HasAd","HasExchange","HasOracle","HasSQL","HasSharepoint" $applist = @{} $apps | % { $applist[$_] = @() } $ids | % { $id = $_ $rpwithid = $rps | ? { $_.ObjectId -eq $id } | Sort-Object -Property creationtime -Descending $apps | % { $hasapp = $false $app = $_ $detectedobject = 0 for($i=0; ($i -lt $rpwithid.Count) -and (-not $hasapp); $i++) { $rpv = $rpwithid[$i] if($rpv."$app") { $hasapp = $true $detectedobject = New-Object -TypeName psobject -Property @{ Application=($app -replace "^Has",""); "VM Name"=$rpv.VmName; FQDN=$rpv.Fqdn; "Detection Date"=(get-date -format "yyyy/MM/dd" $rpv.CreationTime); "Location"=$rpv.AuxData.Location } } } if($hasapp) { $applist[$app] += $detectedobject } } } $header = "Veeam App Detection" $html = "" $applist.Keys | Sort-Object | % { $apptab = $applist[$_] if($apptab.Count -gt 0) { $html += ("

{0}

" -f ($_ -replace "^Has","")) $html += ( $apptab | ConvertTo-Html -Property "Detection Date","Location","VM Name","FQDN" -Fragment) $html += "

" } } ConvertTo-Html -head $header -Body $html > $outfile