troubleshooting Question

Configure Powershell to HTML Script

Avatar of E=mc2
E=mc2 asked on
PowershellHTML* HTML 5Scripting Languages
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

Open in new window


How can I modify this so that I can apply the header information?
Or how should this be changed, any better ideas?
ASKER CERTIFIED SOLUTION
Dustin Saunders
Co-Founder and Chief Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2016

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
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