Private/Get-ModulePSScriptRoot.ps1

function Get-ModulePSScriptRoot {
    <#
.SYNOPSIS
    Gets the PstModules ModulePSScriptRoot variable
.DESCRIPTION
    Gets the PstModules ModulePSScriptRoot variable amd writes the output
.EXAMPLE
    Get-ModulePSScriptRoot
#>

    begin {
        Write-Debug -Message "Begin '$($MyInvocation.MyCommand.Name)' at '$(Get-Date)'"
    }
    process {
        try {
            Write-Information -Message "Get variable 'ModulePSScriptRoot'"
            Write-Output $Script:ModulePSScriptRoot
        }
        catch {
            if ($_.Exception -and $_.Exception.Message) {
                Write-Error "An error occurred: $($_.Exception.Message)"
            } else {
                Write-Error "An error occurred, but no additional information is available."
            }
        }
    }
    end {
        if ($?) {
            Write-Debug -Message "End '$($MyInvocation.MyCommand.Name)' at '$(Get-Date)'"
        }
    }
}