When ValidateMailEnabledPublicFolders.ps1 produces the MailPublicFolderOrphans.txt file, it provides a command to delete all the folders listed in that file. That command uses DirectoryEntry.DeleteTree(). Unfortunately, that fails in certain permissions configurations, because DeleteTree permissions are different from DeleteChild permissions.
Another way to delete these objects is to call DirectoryEntry.Children.Remove() from the parent container, and this requires less permissions.
When ValidateMailEnabledPublicFolders.ps1 produces the MailPublicFolderOrphans.txt file, it provides a command to delete all the folders listed in that file. That command uses DirectoryEntry.DeleteTree(). Unfortunately, that fails in certain permissions configurations, because DeleteTree permissions are different from DeleteChild permissions.
Another way to delete these objects is to call DirectoryEntry.Children.Remove() from the parent container, and this requires less permissions.