-2

I want to add a user to NTFS Permission and give full control to a specific folder.

This is the code that I found in internet, but it gives me an error.

Set-ACL -Path "C:\Program Files (x86)\TEST" -Account "DESKTOP-R5C0QAA\Bobby" -AccessRights FullControl
Set-Acl : A parameter cannot be found that matches parameter name 'Account'.
At line:1 char:45
Set-ACL -Path "C:\Program Files (x86)\TEST" -Account "DESKTOP-R5C0QAA ...
CategoryInfo          : InvalidArgument: (:) [Set-Acl], ParameterBindingException
FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetAclCommand
recnac
  • 3,744
  • 6
  • 24
  • 46
Bobs
  • 1
  • 1
  • 2
    What is the error you get? – Wai Ha Lee Apr 18 '19 at 23:15
  • as WaiHaLee mentioned, the lack of any hint of what went wrong is ... pretty much a show-stopper. [*grin*] however, the cmdlet you list is NOT installed by default. did you install the module that it comes from? – Lee_Dailey Apr 18 '19 at 23:34
  • Probably you will have to install the according module [NTFSSecurity](https://www.powershellgallery.com/packages/NTFSSecurity/4.2.4) first. You might start with learning the very basics of Powershell first. ;-) – Olaf Apr 18 '19 at 23:35
  • Have you tried looking for similar questions here on StackOverflow? Perhaps [this answer](https://stackoverflow.com/a/28310436/3245749) will help. – TheMadTechnician Apr 19 '19 at 00:03
  • Possible duplicate of [Setting NTFS Permissions With Powershell](https://stackoverflow.com/questions/40336969/setting-ntfs-permissions-with-powershell) – jessehouwing Apr 19 '19 at 09:53
  • Hey Bob, running `get-help set-acl` will tell you the available options for `set-acl` and yoiu'll find it expects a completely different set of parameters. – jessehouwing Apr 19 '19 at 09:53

1 Answers1

0

Here the easiest way i could find.

Install-Module NTFSSecurity
Add-NTFSAccess –Path "C:\Program Files (x86)\TEST" –Account "DESKTOP-R5C0QAA\Bobby" –AccessRights FullControl

More info here on NTFS Security module

JahSam
  • 46
  • 5