Note: This article was originally written on reich-consulting.net. Reich Web Consulting has narrowed its focus to the web and no longer offers tech support services, so we’ve moved all of our tech support content off-site. We hope you find this article useful. It is provided as-is, and we will no longer provide support on this topic.
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.
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] /PersistentNET USE [drive] /PERSISTENT:YES
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 /PersistentNET 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 /PersistentNET USE * /DELETE /PERSISTENT:YES