I have three file servers and need to automate tasks regarding setting permissions on folders on these.
I have no problems setting permissions on the folders of the mountpoints, but cannot find a way to do this on root on the physical disks under the mountpoints. Via the GUI, you can do this task using two different methods.
1. Via disk management locally on the fileserver(rightclick on physical disk-> security
2. Right-click on mount point -> properties of mount point -> security ( if this is done on a remote server the properties button is greyed out)
How can this be done in powershell? Will it be possible to do from a remote server? I have tried this so far:
$server = fileserver1
$dep = testmp
$depgroup= "domain\testgroup"
$disk = Get-WmiObject Win32_Volume -Computer $server -Filter "Label = '$dep'"
$path = $disk + (Missing something here to get the job done)
$perm_string = $depgroup + ":(OI)(CI)(RX)"
icacls $path /grant $perm_string | Out-Null