Powershell 如何在windows中删除/删除装载点

Powershell 如何在windows中删除/删除装载点,powershell,wmi,mount-point,Powershell,Wmi,Mount Point,我正在寻找使用powershell/wmi/C删除装载点的方法。我使用win32_卷查找哪些卷具有装载点,并可以在名称和标题下找到路径,但我不知道如何删除这些装载点。win32_卷命名空间有一个创建它们的方法,但没有要删除的内容。win32_装入点是只读的。尚未找到解决方案。具有Remove-MountPoint cmdlet。具有Remove-MountPoint cmdlet 我将其转换为纯powershell,因此不依赖于外部模块 我将其转换为纯powershell,因此不依赖于外部模块。

我正在寻找使用powershell/wmi/C删除装载点的方法。我使用win32_卷查找哪些卷具有装载点,并可以在名称和标题下找到路径,但我不知道如何删除这些装载点。win32_卷命名空间有一个创建它们的方法,但没有要删除的内容。win32_装入点是只读的。尚未找到解决方案。

具有Remove-MountPoint cmdlet。

具有Remove-MountPoint cmdlet

我将其转换为纯powershell,因此不依赖于外部模块


我将其转换为纯powershell,因此不依赖于外部模块。

下面是用于删除装载点的powershell命令

# remove the mount point
$Driveletter='E'
Get-Volume -Drive $DriveLetter | Get-Partition | Remove-PartitionAccessPath -accesspath "$DriveLetter`:\"

下面是用于删除装入点的powershell命令

# remove the mount point
$Driveletter='E'
Get-Volume -Drive $DriveLetter | Get-Partition | Remove-PartitionAccessPath -accesspath "$DriveLetter`:\"

这些cmdlet对我Windows 2008 R2、PowerShell 5不可用。@Joost PowerShell cmdlet特定于操作系统。此cmdlet从windows 2012起可用windows 2008 R2、PowerShell 5不支持这些cmdlet。@Joost PowerShell cmdlet特定于操作系统。此cmdlet从windows 2012开始提供