For me, the graphical interface for file shares is just terrible. Therefore this article shows how a network share can be created in PowerShell.
We need two commands: New-SmbShare and Grant-SmbShareAccess. The following command creates a new share and grants Full Control to everyone. Why Full Control? It is recommended by Microsoft and Best Practice. Consider: Be generous with share permissions and strict with NTFS permissions. 😉
Let´s move on with the PowerShell One-Liner.
New-SmbShare -Name Data -Path C:\Data | Grant-SmbShareAccess -AccountName Everyone -AccessRight Full
For checking run Get-SmbShareAccess and Get-SmbShare.
Get-SmbShareAccess -Name Data
Get-SmbShare
Categories: PowerShell
2 replies »