troubleshooting Question

Configure Powershell to HTML Script

Avatar of E=mc2
E=mc2 asked on
HTMLScripting LanguagesPowershell* HTML 5
4 Comments1 Solution16 ViewsLast Modified:
I would like to change the configuration on the following script so that the output is more pleasant on the eye with colours around the headings.

I would have added ConvertTo-Html -Head $css, if it was a normal ConvertTo-Html but as you can se I am using ConvertTo-EnhancedHTMLFragment instead..

$css = @"
<style>
h1, h5, th { text-align: center; font-family: Segoe UI; }
table { margin: auto; font-family: Segoe UI; box-shadow: 10px 10px 5px #888; border: thin ridge grey; }
th { background: #0046c3; color: #fff; max-width: 400px; padding: 5px 10px; }
td { font-size: 11px; padding: 5px 20px; color: #000; }
tr { background: #b8d1f3; }
tr:nth-child(even) { background: #dae5f4; }
tr:nth-child(odd) { background: #b8d1f3; }
</style>
"@

$Services = Import-CSV "Report1*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 1</h2>" -MakeTableDynamic
$Services2 = Import-CSV "Report2*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 2</h2>" -MakeTableDynamic
$Services3 = Import-CSV "Report3*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 3</h2>"
ConvertTo-EnhancedHTML -HTMLFragments $Services, $Services2, $Services3 -CssUri C:\PowerShell\CSS\styles2.css | Out-File DynamicExample.html

How can I modify this so that I can apply the header information?
Or how should this be changed, any better ideas?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros