private/get-wellknownsid.ps1

function get-wellknownsid {
    Param (
        [System.Security.Principal.WellKnownSidType]$account
    )
    begin {
        $DSE = ([adsi]"LDAP://rootDSE")
        $ADSIDomain = [adsi]"LDAP://$($DSE.defaultNamingContext.value)"
        $thisDomain = @{
            DN = $DSE.defaultNamingContext.value
            DNSRoot = $ADSIDomain
            NetBIOS = $env:UserDomain
            SID = (New-Object 'Security.Principal.SecurityIdentifier' [byte[]]($ADSIDomain.objectSID).value,0).value       
        }
    }
    process{
        $SIDSuffix = [System.Security.Principal.WellKnownSidType]::$account.value__
        "$DomainSID-$SIDSuffix"

    }
    
}