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.

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] /PersistentNET 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 /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
Reich Web Consulting

Written by

Purveyor of fine web creations. Former tech support geniuses. Occasional spouter of opinions on topics of politics and ethics.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade