Jump to content

aclarke

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

About aclarke

Personal Information

  • Occupation
    ICT Technician
  1. Here are two PowerShell scripts I wrote for setting up a folder with multiple shares for different users. For setting the NTFS permissions to the folders: cd "C:\root\folder\where\shares\are\located" $acls = get-acl "C:\root\folder\where\shares\are\located\*" $folder = gci "C:\root\folder\where\shares\are\located" ForEach ($acl in $acls){ $arg = New-Object System.Security.AccessControl.FileSystemAccessRule("domain\user","FullControl","ContainerInherit, ObjectInherit","None","Allow") $acl.SetAccessRule($arg) Set-Acl $folder $acl } You can simplify this down to: $acl = get-acl "folder" $arg = New-Object System.Security.AccessControl.FileSystemAccessRule("domain\user","FullControl","ContainerInherit, ObjectInherit","None","Allow") $acl.SetAccessRule($arg) Set-Acl "folder" $acl To elaborate a bit on the AccessRule it is taking the user, then what control they have, whether or not it is inheriting various permissions '"ContainerInherit, ObjectInherit","None"' and "Allow" is for the permission specified before, being "FullControl". I couldn't get multiple groups for acl to work very well for me. To do this I would re-do the prior loop with the other user as another script block. For sharing the folders and setting their share permissions: $folders = gci ForEach ($folder in $folders) { $path = "Z:\path\to\folder\$user" $user = $folder net share $user$=$path "/GRANT:domain\user,full" "/GRANT:domain\group,full" } Again this can be simplified to just: net share sharename=Z:\path\to\share "/GRANT:domain\user,full" "/GRANT:domain\group,full" Just keep adding on "/GRANT:domain\userorgroup,read or write or full" as you need. There probably is a more elegant way of doing this, but this is something I came up with rather quickly on the spot to get the shares done in time.
  2. Try running this as a scheduled task run with the highest privilege. I believe this should still work on Windows 8 as it does with Windows 7.
×
×
  • Create New...