Private/Utilities.psm1

function AssertElevated {

    ## https://superuser.com/questions/749243/detect-if-powershell-is-running-as-administrator
    $elevated = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544")
    if ($elevated -eq $false) {
        throw "In order to install services, please run this script elevated."
    }
}

Function ImportSifPrivates {

    $sifPath = Split-Path -Parent ((Get-Module SitecoreInstallFramework).Path)
    $private = Join-Path -Path $sifPath -ChildPath 'Private'
    # Dot source to scope

    # Get Functions
    $privates = Get-ChildItem -Path $private -Include *.ps1 -File -Recurse

    # Dot source to scope
    # Private must be sourced first - usage in public functions during load
    ($privates) | ForEach-Object {
        try {
            . $_.FullName
        }
        catch {
            Write-Warning $_.Exception.Message
        }
    }

}

Export-ModuleMember -Function ImportSifPrivates
Export-ModuleMember -Function AssertElevated