<<< Back to Search

Delete Network Shared Drive (SMB Share) ::: Remove-SmbShare

Delete a Network Shared Drive (SMB Share) to enable files for remote access.

Example 1: Remove with Confirmation

#Remove Network Shared Drive Confirmation requested
Remove-SmbShare -Name "MyShare"

PS C:\>

Confirm
Are you sure you want to perform this action?
Performing operation 'Remove-Share' on Target '*,MyShare'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

Example 2: Remove without Confirmation

#To avoid confirmation use parameter -force
Remove-SmbShare -Name "MyShare" -Force

PS C:\>

<< This command doesn't return information >>

Availability by OS:

Windows 8+ / Windows Server 2012 R2

More to explore from this example

How to create Network Shared Drive:

  • Create Network Shared Drive (SMB Share) ::: New-SmbShare

New-SmbShare ::: Command reference: https://docs.microsoft.com/en-us/powershell/module/smbshare/new-smbshare

Remove-SmbShare ::: Command refrence: https://docs.microsoft.com/en-us/powershell/module/smbshare/remove-smbshare