- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove windows folder sharing using PowerShell?
To remove the windows folder sharing using PowerShell, we can use the Remove-Smbshare command. For example,
PS C:\Temp> Remove-SmbShare -Name DSC Confirm Are you sure you want to perform this action? Performing operation 'Remove-Share' on Target '*,DSC'. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Once you use this command, it will ask for confirmation. To remove the sharing forcefully, use - Force parameter. For example,
Remove-SmbShare -Name DSC -Force
To remove the shared folder permissions on the remote computer, you need to use the CIM session.
In the below example, the DSC folder will be removed from sharing from the LabMachine2k16 machine.
$sess = New-CimSession -ComputerName LabMachine2k16 Remove-SmbShare -Name DSC -Session $sess -Force
- How to share a windows folder using PowerShell?
- How to remove windows features using PowerShell?
- How to remove Windows service with PowerShell?
- How to get the folder size using PowerShell?
- How to Get Windows features using PowerShell?
- How to stop a windows service using PowerShell?
- How to start a windows service using PowerShell?
- How to start multiple windows services using PowerShell?
- How to disable windows firewall profiles using PowerShell?
- How to get installed windows update using PowerShell?
- How to find Windows Product Key Using PowerShell?
- How to delete the windows certificate using PowerShell?
- How to change SMB shared folder access permission using PowerShell?
- How to get windows firewall profile settings using PowerShell?
- How to get the Windows certificate details using PowerShell?