I'm trying to put up together a report that amongst other things will check on settings of the Audit policy using auditpol. I use the following
$settins =@()
foreach($folder in $folders){
$settins += Invoke-Command "$computer" -scriptblock{"Audit settings on $args"; auditpol /get /subcategory:"File Share" | where {$_ -match "Share"}} -ArgumentList $folder
}
$settings = $settings l Out-String
this then ends up being converted to html
$fragment2 = $settings l ConvertTo-HTML -Fragment -PreContent '<h2>Audited folders</h2>' l Out-String #as seen on Scripting Guy ;P
and all report gets put together with
ConvertTo-HTML -head $head -PostContent $fragment1, $fragment2,.... | Out-File report.html
Trouble is this bit doesn't look good as the whole output of $settings gets into one cell. To go around this I was thinking of somehow making the titles of each folder in my $folders and then if the output of auditpol which looks something like below wouldn't be that bad. Unfortunately I'm not sure how to do that.
Audit on c:\folder1 File Share success Audit on c:\folder2 File Share ....