Add-Type @"
using System;
using System.Runtime.InteropServices;
public class MountPoint
{
[DllImport(“kernel32.dll”, CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool DeleteVolumeMountPoint(string mountPoint);
}
"@
Is it possible to do it more simple, for example with WMI?
Sorry, I’m new in PowerShell
Sorry. So you have an existing partition on a physical drive that you want to no longer have a drive letter assigned? Or remove the partition? Or just hide the partition?
Set-Partition has a parameter of NoDefaultDriveLetter that may be what you are looking for, but I would need more specifics.
Thank you, Dave. May be it is not in pure powershell, but it works! I appreciate.
Steve, yeah I don’t want to longer have a drive letter assigned, but do not remove drive. I don’t want to hide partition, of course I can do it (in user space) from registry.
From Help:
-NoDefaultDriveLetter<Boolean>
Specifies that the automatic assignment of a drive letter is disabled. This is only honored for GPT disks. This attribute is useful in storage area network (SAN) environments.