HTML report with Powershell Data

Welcome Forums General PowerShell Q&A HTML report with Powershell Data

This topic contains 2 replies, has 3 voices, and was last updated by

3 months ago.

  • Author
  • #113858

    Points: 0
    Rank: Member


    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

  • #113890

    Points: 492
    Helping Hand
    Rank: Contributor

    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.

    Creating Colorful HTML Disk Reports with PowerShell

  • #113953

    Points: 1,759
    Helping HandTeam Member
    Rank: Community Hero

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

The topic ‘HTML report with Powershell Data’ is closed to new replies.