Automatic Document & Report Generation (Part 1)

by Jul 12, 2018

Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word format.

To use this module, simply run this command:

Install-Module -Name PScribo -Scope CurrentUser -Force

Next, you can generate simple documents like this:

# https://github.com/iainbrighton/PScribo
# help about_document

# create a folder to store generated documents
$OutPath = "c:\temp\out"
$exists = Test-Path -Path $OutPath
if (!$exists) { $null = New-Item -Path $OutPath -ItemType Directory -Force }


Document 'Report'  {
    Paragraph -Style Heading1 "System Inventory for $env:computername"
    Paragraph -Style Heading2 'BIOS Information'
    Paragraph 'BIOS details:' -Bold
    $bios = Get-WmiObject -Class Win32_BIOS | Out-String
    Paragraph $bios.Trim()
} | 
Export-Document -Path $OutPath -Format Word,Html,Text 

# open the generated documents
explorer $OutPath

Twitter This Tip! ReTweet this Tip!