Public/Get-P1MsiInstall.ps1

function Get-P1MsiInstall {
    <#
    .Synopsis
    Get all PlannerOne installation done with MSI.
 
    .Description
    Read Windows registry to get all PlannerOne unsintall keys.
 
    .Parameter OnlyServer
    Display only server installation.
     
    .Parameter InstallLocation
    The MSI install location to filter
     
    #>

    [cmdletbinding()]
    param(
    [switch] $OnlyServer,
    [string] $InstallLocation
    )    
    Process {
    $Pattern = "^PlannerOne*"
    if ($OnlyServer) {
        $Pattern = "^PlannerOne.for.Dynamics.NAV*"
    }

    if (!$InstallLocation) {
        gci "hklm:\software\microsoft\windows\currentversion\uninstall" | foreach { gp $_.PSPath } | select DisplayName,DisplayVersion,InstallDate,Publisher,PSChildName,InstallLocation | where { $_.DisplayName -match $Pattern }
    
    } else {
        gci "hklm:\software\microsoft\windows\currentversion\uninstall" | foreach { gp $_.PSPath } | select DisplayName,DisplayVersion,InstallDate,Publisher,PSChildName,InstallLocation | where { $_.DisplayName -match $Pattern -AND $_.InstallLocation -eq $InstallLocation }
    }
    }
}