Hi,
Welcome to the Microsoft Q&A platform!
You can try to use the Add-ADPermission
cmdlet to set permissions.
For example, to prevent a specific user or group from expanding a distribution group:
Add-ADPermission -Identity "DistributionGroupName" -User "UserOrGroupName" -Deny -ExtendedRights "Read Members"
More details about this cmdlet you can refer to:Add-ADPermission
Please feel free to contact me for any updates. And if this helps, don't forget to mark it as an answer!