SID-500

Home » PowerShell » PowerShell: How to create File Shares

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


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 )

Google+ photo

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

Connecting to %s

Categories

Who is the blogger?

My name is Patrick Grünauer (pewa2303). I am from Austria. On sid-500 I write about Windows, Cisco and IT-Security in English and German. Have fun while reading!

Patrick Gruenauer
Follow SID-500 on WordPress.com