Well, we know that we can assign NTFS permission from local machine using ICACLS command.
How about assigning NTFS permission from share folder? The answer is yes, you can.
Sample Share Folder Structure:
Steps:
S1-1. In Share folder, make sure the administrator who is executed script has Share Permission at least Read and has Full NTFS permission. Fail to set this permission will result in Access is denied.
C:\>ICACLS "\\TLDFSRS1N1\Share1\Notes\Doc1" /GRANT "TestLab\TestUserAndy:M"
\\TLDFSRS1N1\Share1\Notes\Doc1: Access is denied.
Successfully processed 0 files; Failed processing 1 files
S1-2. To assign NTFS permission using ICACLS for a single folder/file
C:\>ICACLS "\\TLDFSRS1N1\Share1\Notes\Doc1" /GRANT "TestLab\TestUserAndy:M"
processed file: \\TLDFSRS1N1\Share1\Notes\Doc1
Successfully processed 1 files; Failed processing 0 files
S1-3. To assign NTFS permission using ICACLS with Inheritance
C:\>ICACLS "\\TLDFSRS1N1\Share1\Notes\Doc1" /GRANT "TestLab\TestUserAndy:(CI)(OI)M"
processed file: \\TLDFSRS1N1\Share1\Notes\Doc1
Successfully processed 1 files; Failed processing 0 files