How to share a folder / shared folder in windows server using windows PowerShell with example

Quite easy, with a one-liner. Windows Server 2012 provides Windows PowerShell cmdlets and WMI objects to manage SMB file servers and SMB file shares. The SMB cmdlets are packaged into two modules called SmbShare and SmbWitness. These modules are automatically loaded (thanks to new module auto-loading feature) whenever you refer to any of the cmdlets included. No upfront configuration is required. Note: Check the output of Get-Module command before and after you run the following one-liner to see that SmbShare module is loaded behind the scenes.)

New-SmbShare –Name MyShare –Path C:\Test –Description ‘Test Shared Folder’ –FullAccess Administrator –ChangeAccess DouglasAdams -ReadAccess Everyone


Credit : http://powershellmagazine.com

Comments