KiXtart Fails to Delete Network Drives

I recently ran into an issue with a logon script written in KiXtart failing to disconnect network drives. I can only guess from the dozens of forum posts I found online that this is a common problem that scripters run into.  Luckily there is a simple solution.

The Problem

When you issue a Use “<drive>” /Delete comment from KiXtart or a NET USE <drive> /DELETE batch file command, the drive letter in question isn’t actually deleted from My Computer. Instead, the drive will be listed as a Disconnected Network Drive and when opened it will automatically reconnect.  This happens when the drive was initially connected using by mapping the drive manually and selecting “Reconnect at logon” or by executing one of the following commands:

Use [drive] /Persistent
NET USE [drive] /PERSISTENT:YES

The Solution

Deleting persistent drives may require that you use the /Persistent switch when you execute the delete command. You can delete a single network drive using one of the following commands:

Use [drive] /Delete /Persistent
NET USE [drive] /DELETE /PERSISTENT:YES

Or alternatively, you can delete all network drives at the beginning of your script using one of the following:

Use * /Delete /Persistent
NET USE * /DELETE /PERSISTENT:YES