HTML report with Powershell Data

Greetings,

I would like to create html report with Powershell data. I have html code and powershell commands for my result. But I don't know to combine these two in one.
Per example: I want
HTML header is " Welcome to my page"
body (Powershell commands like get-date, psversiontable, system information)

HTML footer is "Please let us know your suggestions"

Any Suggestions would be appreciated!


Thank you in Advance :-)

Please have look at my powershell script as below.

$head = @"

HTML Screen Saver

Use the HTML refresh meta tag or a script to change pages

Businesses, you could use it so that idle PCs display your intranet
site, or even a PowerPoint presentation of your latest product

Demo page 2

"@

Function Win-Win{

Site configuration

$SiteCode = "*** # Site code
$ProviderMachineName = “******” # SMS Provider machine name

Customizations

$initParams = @{}
#$initParams.Add(“Verbose”, $true) # Uncomment this line to enable verbose logging
#$initParams.Add(“ErrorAction”, “Stop”) # Uncomment this line to stop the script on any errors

Do not change anything below this line

Import the ConfigurationManager.psd1 module

if((Get-Module ConfigurationManager) -eq $null) {
Import-Module “$($ENV:SMS_ADMIN_UI_PATH)…\ConfigurationManager.psd1” @initParams
}

Connect to the site’s drive if it is not already present

if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
}

Set the current location to be the site code.

Set-Location “$($SiteCode):” @initParams
$count = (get-cmdevice -collectionname “SPaCE Test Windows 10”).count
$Totalcount = "Total Number of Migrated Windows 10 Machines " + $count
$Totalcount | Set-Content “C:\temp\Windows 10 Count.html”
}

Call Function

Win-Win

This is not a stand alone PS code issue, but a WebDev HTML style / format implementation. That being said. Take a look and this detailed article and the full example / with code provided there.

Though you are after more items than the article covers, it should get you where you want to be.

https://jdhitsolutions.com/blog/powershell/6130/creating-colorful-html-disk-reports-with-powershell/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JeffsScriptingBlogAndMore+%28The+Lonely+Administrator%29

You can also read our free ebook on Creating HTML Reports in PowerShell.