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
(Get-LocalGroupMember groupname).name `
-AccessRight Read -Verbose -Confirm:$false
, simply replace the value against -AccountName with groupname.