Private/ps1/Get-ServiceNameApprxr.ps1

<#
.SYNOPSIS
    Returns the Apprxr service name, using the configured extension if present.
 
.DESCRIPTION
    This function retrieves the service name for Apprxr, using the ServiceExtension value from configuration if it exists. The result is either 'ApprxrService' or 'ApprxrService_<Extension>', where <Extension> is the configured value. This is useful for service management scripts that need to reference the correct service name.
 
.EXAMPLE
    Get-ServiceNameApprxr
    # Returns 'ApprxrService' or 'ApprxrService_<Extension>' depending on configuration.
 
.NOTES
    - The ServiceExtension is set during service installation if an extension is provided.
    - If no extension is configured, the base name 'ApprxrService' is returned.
#>

function Get-ServiceNameApprxr {
    [CmdletBinding()]
    param(
       
    )
    
    $Extension = Get-ApprxrConfigurationValue -Key 'ServiceExtension' -ErrorAction Stop
    if ($Extension) {
        return "ApprxrService_$Extension"
    } else {
        return "ApprxrService"
    }
}