PowerShell: performance counters

Using Workflow…

And er not…

Pester: pretty summaries

Short examples of a mix of passing and failing Pester tests being rendered in a browser, using ReportUnit, available on NuGet, and ingesting NUnit output format. Check out the browser screenshots below first for the end result.


# Runs all test suites, passes the output to the NUnit format, renders it, displays in a browser

# see my article here for installing nuget via Choco:

# https://dennisaa.wordpress.com/2017/04/26/powershell-updating-jpg-metadata/

# https://www.nuget.org/packages/ReportUnit/

nuget.exe install ReportUnit

#Then, for example...

# Execute all the tests

$outputName = Get-Random

$outputFile = "$PSScriptRoot/$outputName.xml"

$htmlFile = "$PSScriptRoot/$outputName.html"

Invoke-Pester -PassThru -Strict -OutputFile $outputFile -OutputFormat NUnitXml

.\ReportUnit.1.2.1\tools\ReportUnit.exe $outputFile

Start-Process chrome $htmlFile

PowerShell: $PSScriptRoot…

$PSScriptRoot returns the parent of the current script/invocation.

This summarises:

Write-Output "1.`$PSScriptRoot:[$PSScriptRoot]"
Write-Output "2.Parent:[$(Split-Path -Parent $MyInvocation.MyCommand.Path)]"
Write-Output "3.Leaf:[$(Split-Path -Leaf $MyInvocation.MyCommand.Path)]"
Write-Output "4.Full path:[$($MyInvocation.MyCommand.Path)]"


PowerShell: AVI to mp4 conversion, and related

I’ve been using Handbrake CLI wrapped in PowerShell to convert some bulky old AVI files to MP4, and then to copy those to DVD for another layer of backup.

Some scripts here, here, here and here.

I have just finished a pretty extensive repo and Wiki on this subject, on GitHub, here. The intended audience for this is those who can find their way around Windows, but who know nothing about PowerShell.

I’ve now made a video here to illustrate just the AVI to mp4 conversion part.