Im restructuring a legacy ad
Finished creating the script to create the tree itself with nessesary acl etc
What i want todo now is create appropriate exchange administrative role groups so that for everyou there are separate administrators
i can do it via gui but cannot via powershell
Import-Module ActiveDirectory
Add-PSSnapin microsoft.exchange.management.powershell.snapin
Add-PsSnapin Microsoft.Forefront.Filtering.Management.Powershell
$usersOu = "myOU"
$userGroups = Get-ADGroup -SearchBase $usersOu -Filter * -Properties Description
foreach ($userGroup in $userGroups) {
$groupName = $userGroup.Name
$groupName = $groupName -split "AD ROLE "
$groupNameWeNeed = $groupName[1]
$description = $userGroup.Description
$descriptionSplitter = $description -split ": "
$skoop = $descriptionSplitter[1].Trim()
$ou = (Get-ADOrganizationalUnit $skoop).DistinguishedName
$roleGroupName = "new_Recipient Management - $groupNameWeNeed"
New-RoleGroup -Name $roleGroupName `
-Roles "Active Directory Permissions","Mail Recipient Creation","Mail Recipients", -RecipientOrganizationalUnitScope $ou
#-RecipientOrganizationalUnitScope
#-CustomRecipientWriteScope
}
I keep getting error on the New-rolegroup creation like it couldnt find the ou
but it cant be the case cuz i define the variable $ou and its fine
i have granted myself fullaccess over the ad ou
exchange onpremise 2019
productversion: 15.02.1118.030
If i do the rolegroup via gui i can put in the ou like in picture where red has been used
