Connect først
$Username = "postkasse@domain.dk"
$AddUsername = "bruger@domain.dk"
$CustomFolder = Get-MailboxFolderStatistics -Identity $Username -FolderScope All | Where-Object {$_.FolderPath -like '/Indbakke/Undermappe*'}
foreach ($CustomSubFolder in $CustomFolder) { Add-MailboxFolderPermission -Identity "$($Username):$($CustomSubFolder.FolderPath.Replace("/","\"))" -User $AddUsername -AccessRights Owner }