How do you remove/delete a mount point in windows
I am looking for a way to remove a mount point (with either powershell/wmi/C#). I used the win32_volume
to find what volumes have mount points and can find the path there (under name and caption开发者_Go百科) but I can't figure out how to delete those mount points. The win32_volume
namespace has a method to create them but nothing to delete. The win32_mountpoints
is read only. Haven't had any luck finding a solution.
The PowerShell Community Extensions has a Remove-MountPoint cmdlet.
http://jrich523.wordpress.com/2012/04/27/powershell-remove-a-drive-mountletter-more-win32/
I converted it to pure powershell so there is no dependencies on external modules.
Below is the powershell commands to remove mount points
# remove the mount point
$Driveletter='E'
Get-Volume -Drive $DriveLetter | Get-Partition | Remove-PartitionAccessPath -accesspath "$DriveLetter`:\"
精彩评论