#powershell Grant-SmbShareAccess and Security Groups

Unlike net.exe share, Grant-SmbShareAccess can accept one or more security principals for both user accounts and groups (known as “trustee”) against the -AccountName parameter.

Hence instead of:

#requires -version 4.0
#Windows 8 and Windows Server 2012 or higher
Grant-SmbShareAccess `
-Name sharename`
-AccountName `
(Get-LocalGroupMember groupname).name `
-AccessRight Read -Verbose -Confirm:$false

, simply replace the value against -AccountName with groupname.

Leave a Reply