Function Add-RBACOrg {
        Adds an "Org" OU structure from a predefined template
        This creates a regular OU structure in Active Directory representing a distinct and self-managing business unit or tenant.
        .PARAMETER Org
        The name of the 'org'
        .PARAMETER Description
        The description for the org OU
        .PARAMETER Path
        The distinguishedName for the parent OU of this org
        add-rbacOrg -Org "Developers" -description "Software engineering team"
        This creates an OU tree at "OU=Developers,OU=Orgs,DC=Contoso,DC=Local"
        It should contain the following children OUs:
          * Components
          * Rights
          * Roles
          * PrivilegedAccounts
        add-rbacOrg -Org "Developers" -description "Software engineering team" -path "OU=Orgs,DC=Contoso,DC=Local"
        Creates the OU tree at the specified path

        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)]

        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=1)]

        [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, Position=2)]
        [String]$Path = "OU=$($OrgsOUStruct.Name),$($OrgsOUStruct.path)",

    BEGIN {
        $shouldProcess = @{
            Confirm = [bool]($ConfirmPreference -eq "low")
            Whatif = [bool]($WhatIfPreference.IsPresent)
            verbose = [bool]($VerbosePreference -ne "SilentlyContinue")
        $ResetRoleMembershipParam = @{
            ResetRoleMembership = [bool]($ResetRoleMembership)
        if ($ { $Org = $_.Org}
        if ($PsItem.Description) {$Description = $_.Description}
        if ($PsItem.Path) {$Path = $_.Path}
        if ($PSCmdlet.ShouldProcess($path,"Creating Org structure for $org")) {
            Add-OUStructureFromTemplate -name $Org -Description $Description -path $path -Template $OrgTemplate @shouldProcess @ResetRoleMembershipParam
        start-sleep -seconds 5
        $GPOSpecList = foreach ($GPO in $OrgTemplate.GPOs) {
                Org = $Org
                GPOTemplate = $GPO
        if ($GPOSpecList) {
            if($PSCmdlet.ShouldProcess("Creating GPOs")) {
                $GPOSpecList | CreateOrSetGPO