How to change SMB shared folder access permission using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

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
raja
Published on 01-Mar-2021 14:41:42
Advertisements