Search code examples
powershellclient-servernfsinvalid-argument

Powershell: Grant-NfsSharePermission Full Permissions


Powershell v3.0 Windows Server 2012

I am trying to use the Grant-NfsSharePermission cmdlet to grant read/write access to all users with local admins having full permissions to a NFS share.

Grant-NfsSharePermission -Name "LABS" -Path "C:\LABS" -ClientName "WIN-TGE0C741D5G" -ClientType "builtin" -Permission readwrite

The error I get is the parameter set cannot be resolved using the specified name parameters. It's in the InvalidArgument category. After looking at the built-in examples, I can't seem to see why this is a problem. I even tried replacing the clientname (which is my machine name) with localhost and 127.0.0.1 and same error.


Solution

  • The Grant-NfsSharePermission cmdlet expects either the name of the NFS share or the path to the share. You provided both and it doesn't like that. Provide either just -Name or just -Path, but not both and it should work.

    As TheMadTechnician mentioned in the comments, you can see this by reviewing the online help or built-in help (with Get-Help Grant-NfsSharePermission) and seeing they provide two parameter sets and the examples only show the use of one or the other.