Please refer to the article: Set Permissions for Shared Folders.
It will guide you through the process through GPO’s and scripts and also commands.
You can also refer to the article:
Do test the third party tool specifically made for such scenarios:
Hope this helps you. Do Update us again.