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


For checking run Get-SmbShareAccess and Get-SmbShare.

Get-SmbShareAccess -Name Data


2 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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