Stop Sharing a Folder with Remove-SmbShare

List all SMB shares with Get-SmbShare, then delete an unwanted share with Remove-SmbShare -Force.

WindowsFilessharingadminpowershellMedium risk
Run Get-SmbShare to list shares, then Remove-SmbShare -Name 'Reports' -Force to stop sharing one.

01Command

Command
$ Get-SmbShare | Format-Table Name, Path -AutoSize
Remove-SmbShare -Name 'Reports' -Force

02What it does

Removing the share only un-publishes the folder on the network — the files and their NTFS permissions stay untouched, and hidden system shares such as ADMIN$ and C$ are managed by Windows and shouldn't be removed. Because the access list is destroyed with the share, note it before deleting in case you re-share later. A quick Get-SmbShare audit is also useful after buying a second-hand PC or a malware scare.

03Risk

RiskMedium risk
RequirementsElevated (admin) PowerShell.
!Warning: Clients currently copying from the share will get errors; announce or finish transfers first.

04Undo

Undo
$ Re-create it with New-SmbShare (the access list is deleted with the share, so note it beforehand).

05Sources

  • Remove-SmbShare
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Remove-SmbShare deletes an SMB share by name; -Force suppresses the confirmation prompt.
  • SmbShare module - SS64
    SS64 · technical · 2026-09-17
    Evidence: Lists Get-SmbShare for auditing shares and Remove-SmbShare for deleting them.

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

06Related solutions