I want to create a script from Domain Controller that gives permission to a specific user to folders situated on a File Server.
My domain controller name is DC01, my File Server is FileServer01
I want to give access to two folders with paths:
“s:\data\project01” and “s:\data\project01\2020”
“s:\data” has the resource manager quota and all the subfolders.
I want to assign to “s:\data\project01” read/write permission to “user1”
and to"s:\data\project01\2020" just read permission to “user1”
I have create this script:
$cim=New-CimSession -ComputerName FileServer01
Grant-Fileshareacces -Name “2020” -AccessRight Read -AccountName “user1” -CimSession $cim
It doesn’t work because even if it is a file share server and every folders has got a share path like \FileServer01\data\project01\2020 to be able to see the folders when I run the command:
Get-smbshare -CimSession $cim
I have to go on the folder and click advanced share and tick the box.Otherwise the only folder that I can see with Get-smbshare is “s:\data”.
Anyone has any idea or examples to how to address this task?