PowerShell

PowerShell: How to create File Shares

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

1.PNG

For checking run Get-SmbShareAccess and Get-SmbShare.

Get-SmbShareAccess -Name Data
Get-SmbShare

2.PNG

2 replies »

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.