functions/setup/Get-BcInstallationProperty.ps1

function Get-BcInstallationProperty
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string]$MajorVersion,
        [Parameter(Mandatory=$true)]
        [ValidateSet('Service', 'WebClient')]
        [string]$Component
    )

    $ComponentPath = $Component
    if ($Component -eq 'WebClient')
        { $ComponentPath = 'Web Client' }

    $KeyPath = "HKLM:\Software\Microsoft\Microsoft Dynamics NAV\$($MajorVersion)0\$($ComponentPath)"
    if (Test-Path $KeyPath) {
        return Get-ItemProperty -Path $KeyPath
    }
}