How to change SMB shared folder access permission using PowerShell?


We can use the command Grant-SmbShareAccess to change the shared folder access permission or to assign the new user to the shared folder with permission.

In this example, we have already shared a folder name called “Shared Folder” and everyone's user permission is assigned with the read access and we will change it to the Full access permission.

PS C:\Temp> Get-SmbShareAccess -Name "Shared folder"
Name          ScopeName AccountName AccessControlType AccessRight
----          --------- ----------- ----------------- -----------
Shared folder    *       Everyone          Allow         Read

Example

To change the permission use the below command,

Grant-SmbShareAccess -Name "Shared folder" `
   -AccountName "Everyone" `
   -AccessRight Full -Force

Output −

Name          ScopeName AccountName AccessControlType AccessRight
----          --------- ----------- ----------------- -----------
Shared folder    *       Everyone          Allow          Full

Updated on: 01-Mar-2021

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements