Share a Folder from PowerShell with New-SmbShare

Create an SMB network share with explicit access rights using the SmbShare module — the scripted version of Explorer's Sharing tab.

WindowsFilessharingadminpowershellMedium risk
In an admin PowerShell run New-SmbShare -Name 'Reports' -Path 'C:\Reports' -FullAccess 'Everyone'.

01Command

Command
$ New-SmbShare -Name 'Reports' -Path 'C:\Reports' -FullAccess 'Everyone' -ReadAccess 'Guest'

02What it does

New-SmbShare does what the Sharing tab does but reproducibly: the share name is what other PCs type as \\YourPC\Reports, and the access parameters (-FullAccess, -ReadAccess, -ChangeAccess, -NoAccess) control who can do what. NTFS permissions still apply on top, so a user needs rights in both layers. This is the PowerShell 5.1+ way; the legacy equivalent is net share Reports=C:\Reports /GRANT:Everyone,FULL.

03Risk

RiskMedium risk
RequirementsRun in an elevated (admin) PowerShell; Server service must be running; folder path must exist.
!Warning: Sharing with 'Everyone' exposes the folder to the whole network — prefer named accounts, and remember NTFS ACLs must also allow access.

04Undo

Undo
$ Remove-SmbShare -Name 'Reports' -Force

05Sources

  • New-SmbShare
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: New-SmbShare creates an SMB share with -Name, -Path and access lists such as -FullAccess and -ReadAccess.
  • New-SmbShare - SS64
    SS64 · technical · 2026-09-17
    Evidence: Documents share creation parameters and permission groups for the SmbShare module.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions