public static Boolean DisconnectNetworkDrive(string remoteUNC)
{
int ret = SafeNativeMethods.WNetCancelConnection2(remoteUNC, SafeNativeMethods.Connect.CONNECT_UPDATE_PROFILE, false);
if ((ret != 0) && (ret != 2250/*This network connection does not exist*/))
{
LibraryLogging.Error("Unable to disConnect from {0} Error:{1} {2}", remoteUNC, ret, LastError());
return false;
}
return true;
}