Functions/Data/Group-SDDL.ps1

function Group-SDDL
    {
    [CmdletBinding()]
    Param
        (
        # SDDL to deconstruct and reorder
        [Parameter(Mandatory=$true)]
        [string]
        $SDDL
        )
    Begin
        {
        # Treat SDDL Data for Splitting
        $modSDDL = $SDDL.Replace('(',' (')
        }

    Process
        {
        $Split = $modSDDL.Split(' ')
        $OrderSDDL = ($Split[0..1] -join '')+(($Split[2..($split.Count-1)] | sort) -join '')
        }
    End
        {
        $OrderSDDL
        }
    }