Get-SmbShareAccess -name $ShareName | Foreach {Revoke-SmbShareAccess -name $ShareName -AccountName $_.AccountName -Force}
Gets all the permissions for the share, then revokes them.
PS C:\> $ShareName='ScriptFiles >> Get-SmbShareAccess -name $ShareName | Foreach {Revoke-SmbShareAccess -name $ShareName -AccountName $_.AccountName -Force} Name ScopeName AccountName AccessControlType AccessRight ---- --------- ----------- ----------------- ----------- ScriptFiles$ * NT AUTHORITY\SYSTEM Allow Full ScriptFiles$ * *S-1-5-5-0-158796760 Allow Read ScriptFiles$ * *S-1-5-5-0-158796760 Allow Read ScriptFiles$ * Everyone Deny Full