Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

How to remove Drive Letter in PowerShell way

$
0
0

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);
}
“@

[MountPoint]::DeleteVolumeMountPoint(“G:\”)

Is it possible to do it more simple, for example with WMI?
Sorry, I’m new in PowerShell


Viewing all articles
Browse latest Browse all 13067

Trending Articles